From 7d0401f463eed4bf6c2da842c10d227b6c30d2b9 Mon Sep 17 00:00:00 2001 From: Aram Becker Date: Mon, 1 May 2023 21:02:29 +0200 Subject: [PATCH] CI: update docker image for nuxt server target --- .dockerignore | 4 ++++ Dockerfile | 23 +++++++++++++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/.dockerignore b/.dockerignore index 11cc0bbc..b1c626aa 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,6 +3,9 @@ node_modules npm-debug.log .git .gitignore +.devcontainer/ +.github/ +.vscode/ /config /audiobooks /audiobooks2 @@ -13,4 +16,5 @@ test/ /client/.nuxt/ /client/dist/ /dist/ +/build/ /deploy/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index fe2e0059..55a17f39 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,19 @@ ### STAGE 0: Build client ### FROM node:16-alpine AS build WORKDIR /client -COPY /client /client + +COPY /client/package*.json /client/ RUN npm ci && npm cache clean --force -RUN npm run generate + +COPY /client /client +RUN npm run build ### STAGE 1: Build server ### FROM sandreas/tone:v0.1.5 AS tone FROM node:16-alpine +WORKDIR /app + ENV NODE_ENV=production RUN apk update && \ apk add --no-cache --update \ @@ -17,11 +22,17 @@ RUN apk update && \ ffmpeg COPY --from=tone /usr/local/bin/tone /usr/local/bin/ -COPY --from=build /client/dist /client/dist -COPY index.js package* / -COPY server server +COPY package* ./ +COPY --from=build /client/package*.json client/ -RUN npm ci --only=production +RUN npm ci --omit=dev +RUN cd client && npm ci --omit=dev && cd .. + +COPY index.js package* ./ +COPY server server +COPY --from=build /client/nuxt.config.js* client/ +COPY --from=build /client/.nuxt client/.nuxt +COPY --from=build /client/modules client/modules EXPOSE 80 HEALTHCHECK \