Slimmed down docker build thx to copy
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Nicolai Ort 2023-02-23 09:27:00 +01:00
parent c21076a049
commit 10c68cfb37
Signed by: niggl
GPG Key ID: 13AFA55AF62F269F

View File

@ -1,12 +1,15 @@
# Typescript Build # Typescript Build
FROM registry.odit.services/hub/library/node:19.0.1-alpine3.16 FROM registry.odit.services/hub/library/node:19.0.1-alpine3.16 AS build
WORKDIR /app WORKDIR /app
COPY package.json ./ COPY package.json ./
RUN npm i -g pnpm RUN npm i -g pnpm
RUN pnpm i RUN pnpm i
COPY tsconfig.json ./ COPY tsconfig.json ./
COPY src ./src COPY src ./src
RUN pnpm run build RUN pnpm run build \
&& rm -rf /app/node_modules \
&& pnpm i --production --prefer-offline
# final image # final image
FROM registry.odit.services/hub/library/alpine:3.16 FROM registry.odit.services/hub/library/alpine:3.16
WORKDIR /app WORKDIR /app
@ -19,7 +22,6 @@ RUN apk add --no-cache \
ca-certificates \ ca-certificates \
ttf-freefont \ ttf-freefont \
nodejs \ nodejs \
yarn \
font-noto-emoji \ font-noto-emoji \
&& apk add wqy-zenhei --update-cache --repository https://nl.alpinelinux.org/alpine/edge/testing && apk add wqy-zenhei --update-cache --repository https://nl.alpinelinux.org/alpine/edge/testing
@ -35,7 +37,7 @@ RUN addgroup -S pptruser && adduser -S -g pptruser pptruser \
# Run everything after as non-privileged user. # Run everything after as non-privileged user.
USER pptruser USER pptruser
COPY package.json ./ COPY --from=build /app/package.json /app/
RUN yarn COPY --from=build /app/node_modules /app/node_modules
COPY --from=0 /app/dist app COPY --from=build /app/dist app
ENTRYPOINT ["node", "app/app.js"] ENTRYPOINT ["node", "app/app.js"]