-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
29 lines (22 loc) · 1.06 KB
/
Dockerfile
File metadata and controls
29 lines (22 loc) · 1.06 KB
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
# syntax=docker/dockerfile:1
## The above line indicates what version of Dockerfile is in use.
## This docker file build image from all contexts
## Use DOCKER_BUILDKIT=1 in the command line prompt to speed up the build time
FROM node:14.17.1-alpine AS baseBuild
WORKDIR /build
## There are files under workspaces/greeting/dist to app direcotry only
COPY ["./", "/build"]
## In order to install modules from private package registry, access token must
## be loaded by secret. Due to root is not accessible, the best practice is
## using project location to save access token temporaryly.
## And run `install` command at the same layer to get the access to access token.
## Based on https://docs.docker.com/develop/develop-images/build_enhancements/#new-docker-build-secret-information,
## this secret won't store at the final image at all.
RUN --mount=type=secret,id=npm,target=/build/.npmrc \
yarn install
RUN yarn build
FROM node:14.17.1-alpine AS appBuild
WORKDIR /app
COPY --from=baseBuild ["/build", "/app"]
EXPOSE 5478
CMD ["node", "workspaces/greeting/dist/server.js" ]