Skip to content
Snippets Groups Projects
Commit cab588c8 authored by Remi  PLANEL's avatar Remi PLANEL
Browse files

build wiki server

parent ad4e1aed
No related branches found
No related tags found
1 merge request!7K8s deploy
Pipeline #111310 failed
......@@ -10,28 +10,52 @@ stages:
- build
- deploy
build:
.build:
stage: build
image: docker:24
variables:
CONTEXT: "."
before_script:
- npm ci
script:
- NUXT_APP_BASE_URL=/wiki/ npm run generate
artifacts:
paths:
- .output/public
untracked: false
when: on_success
expire_in: "30 days"
pages:
stage: deploy
only:
- main
- i=0; while [ "$i" -lt 12 ]; do docker info && break; sleep 5; i=$(( i + 1 )) ; done
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- NUXT_APP_BASE_URL=/wiki npm run generate
- rm -rf public
- mv .output/public public
artifacts:
paths:
# The folder that contains the files to be exposed at the Page URL
- public
- docker build --pull -t "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$CI_COMMIT_SHORT_SHA" --build-arg="BUILD_OPTIONS=$OPTIONS" -f $DOCKERFILE $CONTEXT
- docker push "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$CI_COMMIT_SHORT_SHA"
# build:
# stage: build
# before_script:
# - npm ci
# script:
# - NUXT_APP_BASE_URL=/wiki/ npm run generate
# artifacts:
# paths:
# - .output/public
# untracked: false
# when: on_success
# expire_in: "30 days"
build:dev:nuxt:
extends: .build-nuxt
variables:
DOCKERFILE: "Dockerfile"
IMAGE_NAME: "df-wiki"
CONTEXT: "./"
rules:
- if: $CI_COMMIT_BRANCH != "main"
# pages:
# stage: deploy
# only:
# - main
# script:
# - NUXT_APP_BASE_URL=/wiki npm run generate
# - rm -rf public
# - mv .output/public public
# artifacts:
# paths:
# # The folder that contains the files to be exposed at the Page URL
# - public
### 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 +21,32 @@ 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 ./
RUN ls -al ./
CMD [ "node", "server/index.mjs"]
### STAGE: Generate ###
FROM node:19.5-bullseye-slim as generate
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 --from=generate /usr/src/app/.output/public /usr/share/nginx/html
CMD ["nginx", "-g", "daemon off;"]
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment