30 lines
800 B
Docker
30 lines
800 B
Docker
# Stage 1
|
|
FROM node:18-alpine as yarn-install
|
|
WORKDIR /usr/src/app
|
|
# Install app dependencies
|
|
COPY package.json yarn.lock ./
|
|
RUN apk update && \
|
|
apk upgrade && \
|
|
apk add --no-cache --virtual build-dependencies bash git openssh python3 make g++ libc6-compat && \
|
|
yarn --frozen-lockfile --no-cache && \
|
|
apk del build-dependencies && \
|
|
yarn cache clean
|
|
|
|
# Runtime container with minimal dependencies
|
|
FROM node:18-alpine
|
|
|
|
RUN apk update && \
|
|
apk upgrade && \
|
|
apk add ca-certificates libc6-compat && \
|
|
ln -s /lib/libc.musl-x86_64.so.1 /lib/ld-linux-x86-64.so.2
|
|
|
|
WORKDIR /usr/src/app
|
|
COPY --from=yarn-install /usr/src/app/node_modules /usr/src/app/node_modules
|
|
# Bundle app source
|
|
COPY . .
|
|
|
|
RUN yarn build
|
|
|
|
EXPOSE 3000
|
|
CMD echo "use docker CLI to specify a startup command"
|