Skip to content

Commit

Permalink
[backend] Production Docker image definition
Browse files Browse the repository at this point in the history
  • Loading branch information
jits committed Jun 8, 2020
1 parent 6da7c5d commit 4247d62
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 18 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.git
node_modules
npm-debug
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# First stage: build server app
FROM node:12 as builder
ENV NODE_ENV=development
WORKDIR /app
COPY . .
RUN yarn install --frozen-lockfile --non-interactive
RUN yarn build

# Second stage: leaner image to deploy and run the built app
FROM node:12-alpine
ENV NODE_ENV=production
WORKDIR /app
COPY --from=builder /app/package.json /app/yarn.lock ./
RUN yarn install --frozen-lockfile --non-interactive && yarn cache clean
COPY --from=builder /app/dist ./dist
CMD ["yarn", "start:prod"]
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"@nestjs/config": "^0.4.2",
"@nestjs/core": "^7.0.0",
"@nestjs/platform-express": "^7.0.0",
"lodash-es": "^4.17.15",
"lodash": "^4.17.15",
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2",
"rxjs": "^6.5.4",
Expand All @@ -39,7 +39,7 @@
"@types/express": "^4.17.3",
"@types/jest": "25.1.4",
"@types/jest-when": "^2.7.1",
"@types/lodash-es": "^4.17.3",
"@types/lodash": "^4.14.155",
"@types/node": "^13.9.1",
"@types/supertest": "^2.0.8",
"@typescript-eslint/eslint-plugin": "^2.34.0",
Expand Down
20 changes: 4 additions & 16 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -807,17 +807,10 @@
resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee"
integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4=

"@types/lodash-es@^4.17.3":
version "4.17.3"
resolved "https://registry.yarnpkg.com/@types/lodash-es/-/lodash-es-4.17.3.tgz#87eb0b3673b076b8ee655f1890260a136af09a2d"
integrity sha512-iHI0i7ZAL1qepz1Y7f3EKg/zUMDwDfTzitx+AlHhJJvXwenP682ZyGbgPSc5Ej3eEAKVbNWKFuwOadCj5vBbYQ==
dependencies:
"@types/lodash" "*"

"@types/lodash@*":
version "4.14.153"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.153.tgz#5cb7dded0649f1df97938ac5ffc4f134e9e9df98"
integrity sha512-lYniGRiRfZf2gGAR9cfRC3Pi5+Q1ziJCKqPmjZocigrSJUVPWf7st1BtSJ8JOeK0FLXVndQ1IjUjTco9CXGo/Q==
"@types/lodash@^4.14.155":
version "4.14.155"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.155.tgz#e2b4514f46a261fd11542e47519c20ebce7bc23a"
integrity sha512-vEcX7S7aPhsBCivxMwAANQburHBtfN9RdyXFk84IJmu2Z4Hkg1tOFgaslRiEqqvoLtbCBi6ika1EMspE+NZ9Lg==

"@types/mime@*":
version "2.0.2"
Expand Down Expand Up @@ -4529,11 +4522,6 @@ locate-path@^5.0.0:
dependencies:
p-locate "^4.1.0"

lodash-es@^4.17.15:
version "4.17.15"
resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.15.tgz#21bd96839354412f23d7a10340e5eac6ee455d78"
integrity sha512-rlrc3yU3+JNOpZ9zj5pQtxnx2THmvRykwL4Xlxoa8I9lHBlVbbyPhgyPMioxVZ4NqyxaVVtaJnzsyOidQIhyyQ==

[email protected]:
version "4.4.2"
resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99"
Expand Down

0 comments on commit 4247d62

Please sign in to comment.