37 lines
713 B
Docker
37 lines
713 B
Docker
FROM node:19.1-alpine as dev
|
|
|
|
RUN apk update && rm -rf /var/cache/apk/*
|
|
|
|
WORKDIR /usr/app
|
|
|
|
# Install node dependencies - done in a separate step so Docker can cache it.
|
|
COPY yarn.lock .
|
|
COPY package.json .
|
|
COPY tsconfig.json .
|
|
|
|
RUN yarn install --ignore-scripts --non-interactive --frozen-lockfile && yarn cache clean
|
|
|
|
COPY . .
|
|
|
|
RUN ls
|
|
|
|
RUN yarn build
|
|
|
|
FROM node:19.1-alpine as production
|
|
|
|
RUN apk update && rm -rf /var/cache/apk/*
|
|
|
|
WORKDIR /app
|
|
|
|
COPY --from=dev /usr/app/dist /app
|
|
COPY --from=dev /usr/app/package.json /app/
|
|
COPY --from=dev /usr/app/yarn.lock /app/
|
|
|
|
RUN chown -R node: .
|
|
|
|
USER node
|
|
|
|
RUN yarn install --non-interactive --frozen-lockfile --production && yarn cache clean
|
|
|
|
CMD ["node", "index.js"]
|