Skip to content

Commit

Permalink
task-8
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanp-epam committed Jun 17, 2021
1 parent 2f55f7e commit b888a75
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Top folder by size
node_modules/
# We don't need dist from the host, because we build it in docker.
dist
# We don't need test folder for production either
test

# Other
.dockerignore
.elasticbeanstalk/*
.eslintrc.js
.git
.gitignore
.prettierrc
Dockerfile*
README.md

25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# build essential node_modules
FROM node:lts-alpine AS production-modules
WORKDIR /app
COPY ./package*.json ./
RUN npm install --only=production && npm prune --production

# make build
FROM node:lts-alpine AS build
WORKDIR /app
# Copy package*.json files, install dependencies
COPY ./package*.json ./
COPY . .
# build application
RUN npm install && npm run build

# Release with Alpine
FROM node:lts-alpine AS release
WORKDIR /app
# Install app and dependencies
COPY --from=build /app/package.json ./
COPY --from=build /app/dist ./dist
COPY --from=production-modules /app/node_modules ./node_modules
USER node
EXPOSE 4000
ENTRYPOINT ["node", "dist/main.js"]

0 comments on commit b888a75

Please sign in to comment.