Skip to content

Commit e9b5a52

Browse files
committed
feat: add docker compose build file
1 parent 0ca70a4 commit e9b5a52

File tree

4 files changed

+33
-15
lines changed

4 files changed

+33
-15
lines changed

apps/database/Dockerfile

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
11
ARG BASE_IMAGE
22

3-
FROM $BASE_IMAGE as base
3+
FROM $BASE_IMAGE
44

55
WORKDIR /apps/database
66

7-
FROM base as dev
8-
9-
CMD yarn dev
10-
11-
FROM base as production_build
12-
137
CMD yarn migrate
148

159
COPY apps/database/package.json apps/database/yarn.lock /apps/database/

apps/graphql/Dockerfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ARG BASE_IMAGE=node:12.18.2-alpine3.11
22

3-
FROM $BASE_IMAGE as base
3+
FROM $BASE_IMAGE
44

55
WORKDIR /app
66

@@ -16,6 +16,4 @@ RUN yarn install --production=true
1616

1717
COPY apps/graphql/src /app/src
1818

19-
FROM base as dev
20-
2119
RUN yarn install

apps/worker/Dockerfile

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ FROM $BASE_IMAGE as base
44

55
WORKDIR /apps/worker
66

7-
FROM base as dev
8-
9-
CMD yarn dev
10-
117
FROM base as build
128

139
COPY apps/worker/package.json apps/worker/yarn.lock /apps/worker/
@@ -20,7 +16,7 @@ COPY apps/worker/src /apps/worker/src
2016

2117
RUN yarn build
2218

23-
FROM base as production
19+
FROM base as prod
2420

2521
CMD yarn start
2622

docker-compose.build.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
version: "3.7"
2+
3+
services:
4+
migrations:
5+
image: postgres-graphql/migrations
6+
build:
7+
context: .
8+
dockerfile: ./apps/database/Dockerfile
9+
args:
10+
BASE_IMAGE: node:15.8.0-alpine3.12
11+
12+
gql:
13+
image: postgres-graphql/graphql
14+
build:
15+
context: .
16+
dockerfile: ./apps/graphql/Dockerfile
17+
args:
18+
BASE_IMAGE: node:15.8.0-alpine3.12
19+
20+
worker:
21+
image: postgres-graphql/worker
22+
build:
23+
context: .
24+
dockerfile: ./apps/worker/Dockerfile
25+
target: prod
26+
args:
27+
BASE_IMAGE: node:15.8.0-alpine3.12
28+
29+
volumes:
30+
pg_data:

0 commit comments

Comments
 (0)