From 4ccc3b1f772e9e27024c58d1094ad68a08e36abf Mon Sep 17 00:00:00 2001 From: Clement Date: Sun, 5 May 2024 11:42:38 +0200 Subject: [PATCH 1/4] feat: docker file form docs --- Express/barAndCafe/Dockerfile_docs | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Express/barAndCafe/Dockerfile_docs diff --git a/Express/barAndCafe/Dockerfile_docs b/Express/barAndCafe/Dockerfile_docs new file mode 100644 index 0000000..89740fb --- /dev/null +++ b/Express/barAndCafe/Dockerfile_docs @@ -0,0 +1,2 @@ +FROM httpd:alpine +COPY ./out/ /usr/local/apache2/htdocs/ \ No newline at end of file -- 2.47.1 From 3bd77c94e942afc39a99f68dff2052267759c816 Mon Sep 17 00:00:00 2001 From: Clement Date: Sun, 5 May 2024 12:25:49 +0200 Subject: [PATCH 2/4] push all action --- .github/workflows/build_docker_astro.yml | 2 - .github/workflows/build_docker_express.yml | 2 - .github/workflows/build_jsdoc_drink.yml | 53 ++++++++++++++++++++++ 3 files changed, 53 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/build_jsdoc_drink.yml diff --git a/.github/workflows/build_docker_astro.yml b/.github/workflows/build_docker_astro.yml index 1aea57a..e1a31b7 100644 --- a/.github/workflows/build_docker_astro.yml +++ b/.github/workflows/build_docker_astro.yml @@ -32,8 +32,6 @@ jobs: type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}} type=semver,pattern=latest - labels: | - org.opencontainers.image.title=AstroFront - name: Login to Gitea uses: docker/login-action@v3 diff --git a/.github/workflows/build_docker_express.yml b/.github/workflows/build_docker_express.yml index 001ff44..4cdd4d1 100644 --- a/.github/workflows/build_docker_express.yml +++ b/.github/workflows/build_docker_express.yml @@ -32,8 +32,6 @@ jobs: type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}} type=semver,pattern=latest - labels: | - org.opencontainers.image.title=AstroFront - name: Login to Gitea uses: docker/login-action@v3 diff --git a/.github/workflows/build_jsdoc_drink.yml b/.github/workflows/build_jsdoc_drink.yml new file mode 100644 index 0000000..0ba1dbe --- /dev/null +++ b/.github/workflows/build_jsdoc_drink.yml @@ -0,0 +1,53 @@ +name: JsDocs +on: + pull_request: + branches: + - '*' +jobs: + coverage: + runs-on: ubuntu-latest + steps: + - name: Checkout # rapatrie le depot + uses: actions/checkout@v3 + + - name: Build + uses: andstor/jsdoc-action@v1 + with: + source_dir: ./Express/barAndCafe/src + recurse: true + output_dir: ./Express/barAndCafe/out + config_file: ./Express/barAndCafe/jsdoc.json + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + git.lab-ouest.org/Epitech/ratrapage_T-WEB_drink_jsdocs + tags: | + type=edge + type=ref,event=pr + type=ref,event=branch + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=semver,pattern=latest + + - name: Login to Gitea + uses: docker/login-action@v3 + with: + registry: git.lab-ouest.org + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_TOKEN }} + + # - name: Set up Docker Buildx + # uses: docker/setup-buildx-action@v3 + + - name: Build and push back + uses: docker/build-push-action@v5 + with: + context: ./Express/barAndCafe + push: true + file: ./Express/barAndCafe/Dockerfile_docs + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file -- 2.47.1 From 0d342485faffe12c57376950975f21f9210f7fe0 Mon Sep 17 00:00:00 2001 From: Clement Date: Sun, 5 May 2024 12:30:54 +0200 Subject: [PATCH 3/4] fix: install better docs --- .github/workflows/build_jsdoc_drink.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_jsdoc_drink.yml b/.github/workflows/build_jsdoc_drink.yml index 0ba1dbe..9df11af 100644 --- a/.github/workflows/build_jsdoc_drink.yml +++ b/.github/workflows/build_jsdoc_drink.yml @@ -17,7 +17,8 @@ jobs: recurse: true output_dir: ./Express/barAndCafe/out config_file: ./Express/barAndCafe/jsdoc.json - + template: better-docs + - name: Docker meta id: meta uses: docker/metadata-action@v5 -- 2.47.1 From aa8d2316c6c6e8695487f63a92ead60b49fb2a36 Mon Sep 17 00:00:00 2001 From: Clement Date: Sun, 5 May 2024 14:18:02 +0200 Subject: [PATCH 4/4] change ci for docker build directly --- .github/workflows/build_jsdoc_drink.yml | 8 ------ Express/barAndCafe/Dockerfile | 2 -- Express/barAndCafe/Dockerfile_docs | 35 ++++++++++++++++++++++++- 3 files changed, 34 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build_jsdoc_drink.yml b/.github/workflows/build_jsdoc_drink.yml index 9df11af..2c2641a 100644 --- a/.github/workflows/build_jsdoc_drink.yml +++ b/.github/workflows/build_jsdoc_drink.yml @@ -10,14 +10,6 @@ jobs: - name: Checkout # rapatrie le depot uses: actions/checkout@v3 - - name: Build - uses: andstor/jsdoc-action@v1 - with: - source_dir: ./Express/barAndCafe/src - recurse: true - output_dir: ./Express/barAndCafe/out - config_file: ./Express/barAndCafe/jsdoc.json - template: better-docs - name: Docker meta id: meta diff --git a/Express/barAndCafe/Dockerfile b/Express/barAndCafe/Dockerfile index 44cc089..09ee8fd 100644 --- a/Express/barAndCafe/Dockerfile +++ b/Express/barAndCafe/Dockerfile @@ -1,5 +1,3 @@ -# This Dockerfile allows you to run AstroJS in server mode - ######### # Build # ######### diff --git a/Express/barAndCafe/Dockerfile_docs b/Express/barAndCafe/Dockerfile_docs index 89740fb..dab2b5c 100644 --- a/Express/barAndCafe/Dockerfile_docs +++ b/Express/barAndCafe/Dockerfile_docs @@ -1,2 +1,35 @@ +######### +# Build # +######### +FROM docker.io/node:20-alpine as BUILD_IMAGE + +# External deps (for node-gyp add: "python3 make g++") +RUN apk add --no-cache git + +# run as non root user +USER node + +# go to user repository +WORKDIR /home/node + +# Add package json +ADD --chown=node:node package.json package-lock.json ./ + +# install dependencies from package lock +RUN npm ci + +# Add project files +ADD --chown=node:node . . + +# build +RUN npm run docs + +# remove dev deps +RUN npm prune --omit=dev + +############## +# Production # +############## FROM httpd:alpine -COPY ./out/ /usr/local/apache2/htdocs/ \ No newline at end of file + +COPY --from=BUILD_IMAGE /home/node/out/ /usr/local/apache2/htdocs/ \ No newline at end of file -- 2.47.1