Merge pull request #12 from Photowall/P5-7626-fix-dev

This commit is contained in:
Anders Gustafsson
2021-08-12 12:02:05 +02:00
committed by GitHub
4 changed files with 17 additions and 12 deletions
-3
View File
@@ -3,10 +3,7 @@ FROM node:14.17.0
# Informs Docker that the container listens on the # Informs Docker that the container listens on the
# specified network ports at runtime # specified network ports at runtime
EXPOSE 4000 EXPOSE 4000
COPY . app/
# Changes working directory to the new directory just created # Changes working directory to the new directory just created
WORKDIR /app WORKDIR /app
# Installs npm dependencies on container
RUN npm ci
# Command container will actually run when called # Command container will actually run when called
CMD ["npx", "nodemon", "-w", "src", "--ext", "ts", "--exec", "ts-node", "src/index.ts"] CMD ["npx", "nodemon", "-w", "src", "--ext", "ts", "--exec", "ts-node", "src/index.ts"]
+11 -1
View File
@@ -3,17 +3,27 @@
Apollo graphql api server for Photowall Apollo graphql api server for Photowall
## Run it locally ## Run it locally
Create an .env file (see .env.example for what to set). Create an .env file (see .env.example for what to set).
### Development
Run Run
``` ```
$ npm install
$ docker compose build $ docker compose build
$ docker compose up $ docker compose up
``` ```
Then head over to [The playground GUI](https://localhost:4000) in the browser Then head over to [The playground GUI](https://localhost:4000) in the browser
See context function of src/index.ts for Authentication options for development.
### Run prod-like container locally
Run
```
$ docker compose -f docker-compose-prodlike.yml build
$ docker compose -f docker-compose-prodlike.yml up
```
## Run tests ## Run tests
Scripts will create the insert sql files for a randomized fake data postgres database. This database is based of the actual db in photowall project. Scripts will create the insert sql files for a randomized fake data postgres database. This database is based of the actual db in photowall project.
@@ -4,16 +4,14 @@ services:
api: api:
build: build:
context: ./ context: ./
dockerfile: ./Dockerfile-dev dockerfile: ./Dockerfile
volumes:
- ./:/app
container_name: photowall.graphql container_name: photowall.graphql
hostname: graphql.local hostname: graphql.local
ports: ports:
- '4000:4000' - '4000:4000'
environment: environment:
- COGNITO_POOL_ID=eu-west-1_3O4VfvPn7 - COGNITO_POOL_ID=eu-west-1_3O4VfvPn7
- DATABASE_URL=postgresql://fondberg:@docker.for.mac.localhost/photowall - DATABASE_URL=${DATABASE_URL}
networks: networks:
default: default:
+4 -4
View File
@@ -4,16 +4,16 @@ services:
api: api:
build: build:
context: ./ context: ./
dockerfile: ./Dockerfile dockerfile: ./Dockerfile-dev
# volumes: volumes:
# - ./:/app - ./:/app
container_name: photowall.graphql container_name: photowall.graphql
hostname: graphql.local hostname: graphql.local
ports: ports:
- '4000:4000' - '4000:4000'
environment: environment:
- COGNITO_POOL_ID=eu-west-1_3O4VfvPn7 - COGNITO_POOL_ID=eu-west-1_3O4VfvPn7
- DATABASE_URL=postgresql://fondberg:@docker.for.mac.localhost/photowall - DATABASE_URL=${DATABASE_URL}
networks: networks:
default: default: