add builder stage, update yarn-lts docker image

This commit is contained in:
2022-05-31 22:42:35 +00:00
parent d5691ad264
commit 9546093ee4

View File

@@ -1,10 +1,19 @@
FROM node:lts-alpine3.12 FROM node:lts-alpine3.15 AS builder
RUN apk add gifsicle libpng libpng-dev libtool file nasm autoconf automake pkgconfig make g++ python2
RUN mkdir /data RUN mkdir /data
COPY ./ /data
WORKDIR /data WORKDIR /data
COPY ./ ./
RUN yarn install && yarn run build
FROM node:lts-alpine3.15
RUN mkdir /data
WORKDIR /data
COPY --from=builder /data/package.json .
COPY --from=builder /data/src/main.js ./src/
COPY --from=builder /data/dist ./dist
RUN yarn install --production RUN yarn install --production
RUN adduser --disabled-password --gecos "" slowdowner RUN adduser --disabled-password --gecos "" slowdowner
RUN chown slowdowner:slowdowner /data RUN chown slowdowner:slowdowner /data
USER slowdowner USER slowdowner
CMD yarn run start CMD yarn run start
EXPOSE 8080 EXPOSE 8080