From af4a83efd2c554bbddf5d9cf94b5572b0add01b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Viricel?= Date: Thu, 1 Feb 2024 15:31:22 +0100 Subject: [PATCH] fix: new docker image with cached steps #150 --- Dockerfile | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8b88ecd45..56c4428d9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,26 +1,32 @@ -ARG NODE_VERSION -FROM node:${NODE_VERSION} +# syntax = docker/dockerfile:1 -RUN apk --no-cache add git +# Base +ARG NODE_VERSION=18.19.0 -# Create app directory -RUN mkdir -p /usr/src/app/.nuxt -WORKDIR /usr/src/app +FROM node:${NODE_VERSION}-slim as base -# Install app dependencies -COPY package.json yarn.lock /usr/src/app/ -RUN yarn install -COPY . /usr/src/app +ARG PORT=3000 + +ENV NODE_ENV=production + +WORKDIR /src + +# Build +FROM base as build + +COPY --link .yarn ./.yarn +COPY --link package.json yarn.lock .yarnrc.yml ./ RUN yarn install -ENV NODE_OPTIONS --openssl-legacy-provider -COPY vidos-config-empty.json vidos-config.json +COPY --link . . + RUN yarn build -# Set environment variables -ENV NODE_ENV production -ENV NUXT_HOST 0.0.0.0 -ENV NUXT_PORT 3000 +# Run +FROM base + +ENV PORT=$PORT + +COPY --from=build /src/.output /src/.output -EXPOSE 3000 -CMD [ "yarn", "start" ] +CMD [ "node", ".output/server/index.mjs" ]