Skip to content

Commit

Permalink
Dockerize the project.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevinjil committed Jul 28, 2020
1 parent afbeecc commit 5738e21
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#IDEs
.vscode
.idea

#Linters and coverages
.nyc_output/
reports

#Nodejs
node_modules
out

#Local data
*.sqlite

### Docker files
Dockerfile
.dockerignore
docker-compose.yml
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Build in a different image to keep the target image clean
FROM node:12-alpine as build
WORKDIR /app
COPY ./package.json ./package-lock.json ./
RUN npm install
COPY ./ ./
RUN npm run build \
&& npm run swagger

# The target image that will be run
FROM node:12-alpine as target
WORKDIR /app
COPY ./package.json ./package-lock.json ./
RUN npm install --production
COPY --from=build --chown=node /app/out/src /app/src
COPY --from=build --chown=node /app/out/swagger.json /app/out/swagger.json
CMD ["node", "src/index.js"]

0 comments on commit 5738e21

Please sign in to comment.