23 lines
813 B
Docker
23 lines
813 B
Docker
# syntax=docker/dockerfile:experimental
|
|
FROM node:14.14.0 as deps
|
|
USER root
|
|
WORKDIR /data
|
|
COPY package.json yarn.lock ./
|
|
#RUN apk add --no-cache git openssh-client
|
|
RUN mkdir -p /root/.ssh
|
|
RUN echo "Host git.lawsnote.com\n\tStrictHostKeyChecking no\n\tUser git\n\tHostname git.lawsnote.com\n\tPort 2222\n\tUserKnownHostsFile /dev/null" > /root/.ssh/config
|
|
# SSH key is set in docker build argument, ex: docker build --ssh default="$SSH_PRIVATE_KEY"
|
|
RUN --mount=type=ssh yarn install --frozen-lockfile
|
|
|
|
FROM node:14.14.0-slim
|
|
WORKDIR /data
|
|
ARG CI_COMMIT_SHA
|
|
COPY . .
|
|
COPY --from=deps /data/node_modules ./node_modules/
|
|
#RUN apk add --no-cache ffmpeg \
|
|
# && chown -R node:node .
|
|
RUN chown -R node:node . \
|
|
&& sed -i "s/__CI_COMMIT_SHA__/$CI_COMMIT_SHA/" ./public/html/version.html
|
|
USER node
|
|
CMD ["yarn", "start"]
|