diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml new file mode 100644 index 0000000..415313b --- /dev/null +++ b/.github/workflows/build-docker-image.yml @@ -0,0 +1,52 @@ +name: Build release Docker image + +on: + # Trigger the action manually from the UI + workflow_dispatch: + # Trigger the action when I create or push a `master` branch + push: + branches: + - 'master' + +env: + DOCKER_IMAGE_NAME: erethon-docs + DOCKER_REGISTRY_URL: ${{ secrets.PRIVATE_REGISTRY_URL }} +jobs: + build_docker_images: + # Job name that shows in the GitHub UI + name: Build Docker Images + # Runner to use + runs-on: ubuntu-latest + + steps: + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ${{ secrets.PRIVATE_REGISTRY_URL }} + username: ${{ secrets.PRIVATE_REGISTRY_USERNAME }} + password: ${{ secrets.PRIVATE_REGISTRY_PASSWORD }} + - name: Checkout + uses: actions/checkout@v3 + + # Build the Docker image + - name: Build the Docker image + run: docker build . --file Dockerfile --tag $DOCKER_IMAGE_NAME:latest + + # Tag the image + - name: Create a latest image as well + run: docker tag $DOCKER_IMAGE_NAME:latest $DOCKER_REGISTRY_URL/$DOCKER_IMAGE_NAME:latest + + # Push the image to the registry + - name: Push the Docker image with version number + run: docker push $DOCKER_REGISTRY_URL/$DOCKER_IMAGE_NAME:latest + + # Remove the local images + - name: Remove the Docker image with version number + run: docker rmi $DOCKER_REGISTRY_URL/$DOCKER_IMAGE_NAME:latest + + - name: Remove the local image + run: docker rmi $DOCKER_IMAGE_NAME:latest + + - name: Trigger Docker re-deployment + run: | + curl -H "Authorization: Bearer ${{ secrets.DEPLOYMENT_TOKEN }}" ${{ secrets.DEPLOYMENT_URL }} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..71e9408 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,45 @@ +# syntax=docker/dockerfile:1 + +# Stage 1: Base image. +## Start with a base image containing NodeJS so we can build Docusaurus. +FROM node:lts as base +## Disable colour output from yarn to make logs easier to read. +ENV FORCE_COLOR=0 +## Enable corepack. +RUN corepack enable +## Set the working directory to `/opt/docusaurus`. +WORKDIR /opt/docusaurus + +# Stage 2a: Development mode. +FROM base as dev +## Set the working directory to `/opt/docusaurus`. +WORKDIR /opt/docusaurus +## Expose the port that Docusaurus will run on. +EXPOSE 3000 +## Run the development server. +CMD [ -d "node_modules" ] && npm run start --host 0.0.0.0 --poll 1000 || npm run install && npm run start --host 0.0.0.0 --poll 1000 + +# Stage 2b: Production build mode. +FROM base as prod +## Set the working directory to `/opt/docusaurus`. +WORKDIR /opt/docusaurus +## Copy over the source code. +COPY . /opt/docusaurus/ +## Install dependencies with `--immutable` to ensure reproducibility. +RUN npm ci +## Build the static site. +RUN npm run build + +# Stage 3a: Serve with `docusaurus serve`. +FROM prod as serve +## Expose the port that Docusaurus will run on. +EXPOSE 3000 +## Run the production server. +CMD ["npm", "run", "serve", "--", "--host", "0.0.0.0", "--no-open"] + +# Stage 3b: Serve with Caddy. +FROM caddy:2-alpine as caddy +## Copy the Caddyfile. +COPY --from=prod /opt/docusaurus/Caddyfile /etc/caddy/Caddyfile +## Copy the Docusaurus build output. +COPY --from=prod /opt/docusaurus/build /var/docusaurus \ No newline at end of file diff --git a/sidebars.js b/sidebars.js index 8da066d..251c0c4 100644 --- a/sidebars.js +++ b/sidebars.js @@ -54,18 +54,6 @@ const sidebars = { ], }, ], - aergia: [ - { - type: 'category', - label: 'Aergia', - items: [ - { - type: 'autogenerated', - dirName: 'aergia', - }, - ], - }, - ], itemsxl: [ { type: 'category',