Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use alpine baseimage, optimise build #8

Merged
merged 2 commits into from
Feb 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 13 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
FROM node:16
FROM alpine:3.15

# Create app directory
WORKDIR /app

# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./

RUN npm install

RUN npm ci --only=production

# Bundle app source
COPY . .

RUN mkdir /data
RUN \
apk -U --update --no-cache add --virtual=build-dependencies \
npm && \
apk -U --update --no-cache add \
nodejs && \
rm -rf ./.git && \
npm install && \
npm ci --only=production && \
mkdir -p ./data && \
apk del --purge \
build-dependencies

EXPOSE 3000
CMD [ "node", "app.js" ]
CMD [ "node", "app.js" ]