-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdockerfile
More file actions
31 lines (23 loc) · 719 Bytes
/
dockerfile
File metadata and controls
31 lines (23 loc) · 719 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
ARG BASE_IMAGE=node:16-alpine
FROM ${BASE_IMAGE} AS builder
env BUILDDIR=/usr/src/app
# Create app directory
WORKDIR $BUILDDIR
COPY . $BUILDDIR
RUN yarn install
# multitsage-build; alpine for lightweight final image
FROM ${BASE_IMAGE}
ENV NODE_ENV=production
ENV APPDIR=/usr/src/app
# create app directory
WORKDIR $APPDIR
RUN chown node:node ${APPDIR}
COPY --from=builder --chown=node:node ${APPDIR}/index.js .
COPY --from=builder --chown=node:node ${APPDIR}/src src
COPY --from=builder --chown=node:node ${APPDIR}/package.json .
COPY --from=builder --chown=node:node ${APPDIR}/yarn.lock .
COPY --from=builder ${APPDIR}/crontab .
USER node
RUN yarn install && yarn cache clean
# express server port
EXPOSE 8080