Skip to content

Commit 37a87b0

Browse files
authored
Merge pull request #110 from NodeFactoryIo/mpetrunic/fix-dockerfile
single multistage docker build
2 parents 6bd96e5 + 4cf1cb8 commit 37a87b0

File tree

4 files changed

+18
-19
lines changed

4 files changed

+18
-19
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ jobs:
33
build:
44
working_directory: ~/app
55
machine:
6-
image: circleci/classic:latest
6+
image: ubuntu-1604:201903-01
77
steps:
88
- checkout
99
- run: chown -R $USER:$USER ~/app

Dockerfile

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:12.13-alpine
1+
FROM node:12.13-alpine as dev
22

33
WORKDIR /usr/app
44

@@ -15,3 +15,15 @@ RUN yarn run compile
1515
RUN chown -R node: .
1616

1717
USER node
18+
19+
FROM node:12.13-alpine as production
20+
21+
WORKDIR /app
22+
23+
COPY --from=0 /usr/app/dist/src /app
24+
COPY --from=0 /usr/app/package.json /app/
25+
COPY --from=0 /usr/app/yarn.lock /app/
26+
27+
RUN yarn install --frozen-lockfile --production && yarn cache clean
28+
29+
CMD ["node", "index.js"]

Dockerfile.production

Lines changed: 0 additions & 15 deletions
This file was deleted.

docker-compose.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
version: "3"
1+
version: "3.4"
22
services:
33
backend:
4-
build: .
4+
build:
5+
context: .
6+
target: dev
57
command: sh -c "yarn run dev"
68
image: nodefactory/hactar-backend:${IMAGE_TAG:-latest}
79
container_name: "${BACKEND_CONTAINER_NAME:-hactar-backend}"

0 commit comments

Comments
 (0)