Skip to content

Commit

Permalink
feat: add Dockerfile (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
magicmatatjahu authored Jan 14, 2022
1 parent 041aedb commit 5333a20
Show file tree
Hide file tree
Showing 10 changed files with 17,796 additions and 9,060 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
npm-debug.log
Dockerfile
.dockerignore
.git
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ node_modules
.vscode
coverage
lib
dist
examples
logs
*.DS_Store
35 changes: 35 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# ---- Base Alpine with installed Node ----
FROM alpine:3.14.3 AS base

# install node
RUN apk add --update \
nodejs=14.18.1-r0 \
npm=7.17.0-r0 \
nghttp2

# ---- Install dependencies ----
FROM base AS build

WORKDIR /app
COPY . .
# install dependencies
RUN npm ci

# build to a production Javascript
RUN npm run build:prod

# ---- Serve ----
FROM base AS release

WORKDIR /app
COPY --from=build /app/dist ./dist
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package* ./
# install only production dependencies (defined in "dependencies")
RUN npm ci --only=production
# copy OpenaAPI document
COPY openapi.yaml ./

EXPOSE 80
CMD ["npm", "run", "start:prod"]
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports = {
setupFiles: ['./tests/jest.setup.ts'],
globals: {
'ts-jest': {
tsconfig: 'tsconfig.json',
tsconfig: 'tsconfig.test.json',
},
},
};
Loading

0 comments on commit 5333a20

Please sign in to comment.