switch to official node image

* split up install steps to take advantage of cache layers
This commit is contained in:
Smith
2023-02-25 15:53:19 +01:00
parent d406a2620a
commit 29e232d9a4

View File

@@ -1,34 +1,23 @@
FROM debian:bullseye as builder
ARG NODE_VERSION=16.15.1
RUN apt-get update; apt install -y curl python-is-python3 pkg-config build-essential
RUN curl https://get.volta.sh | bash
ENV VOLTA_HOME /root/.volta
ENV PATH /root/.volta/bin:$PATH
RUN volta install node@${NODE_VERSION}
#######################################################################
FROM node:18 as builder
RUN mkdir /app
WORKDIR /app
COPY . .
COPY package.json package-lock.json ./
RUN npm install
RUN npm install --production=false && npm run build
RUN rm -rf node_modules && npm install --production=true
COPY . .
RUN npm run build && rm -rf node_modules
#######################################################################
FROM debian:bullseye
FROM node:18
LABEL fly_launch_runtime="nodejs"
COPY --from=builder /root/.volta /root/.volta
COPY --from=builder /app /app
WORKDIR /app
ENV NODE_ENV production
ENV PATH /root/.volta/bin:$PATH
COPY --from=builder /app /app
RUN npm install
CMD [ "npm", "run", "start" ]