Skip to content
Snippets Groups Projects

K8s deploy

Merged Remi PLANEL requested to merge k8s-deploy into dev
2 files
+ 3
1
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 26
4
### Stage Install ###
FROM node:19.5-bullseye-slim as install
RUN mkdir /usr/src/app
WORKDIR /usr/src/app
ENV PATH /usr/src/app/node_modules/.bin:$PATH
COPY package*.json ./
@@ -22,13 +23,34 @@ CMD ["npm", "run", "dev"]
### STAGE: Build ###
FROM node:19.5-bullseye-slim as build
WORKDIR /usr/src/app
COPY --from=install /usr/src/app ./
COPY . /usr/src/app
RUN npm run build
### STAGE: serve ###
FROM node:19.5-bullseye-slim as serve
WORKDIR /usr/src/app
COPY --from=build /usr/src/app/.output ./
CMD [ "node", "server/index.mjs"]
### STAGE: Generate ###
FROM node:19.5-bullseye-slim as generate
ARG BASE_URL=/
ENV NUXT_APP_BASE_URL=${BASE_URL}
WORKDIR /usr/src/app
COPY --from=install /usr/src/app ./
COPY . /usr/src/app
RUN npm run generate
### STAGE: NGINX ###
FROM nginx:stable-alpine
COPY --from=build /usr/src/app/dist /usr/share/nginx/html
EXPOSE 80
FROM nginxinc/nginx-unprivileged:1.25
# RUN rm -rf /usr/share/nginx/html/*
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=generate /usr/src/app/.output/public /etc/nginx/html
CMD ["nginx", "-g", "daemon off;"]
\ No newline at end of file
Loading