Skip to content

Commit

Permalink
Well, add CI again
Browse files Browse the repository at this point in the history
  • Loading branch information
Fyreum committed Jul 14, 2024
1 parent 62a07b4 commit 9109132
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 12 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/build-docker-image.yml
Original file line number Diff line number Diff line change
@@ -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 }}
45 changes: 45 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
12 changes: 0 additions & 12 deletions sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,6 @@ const sidebars = {
],
},
],
aergia: [
{
type: 'category',
label: 'Aergia',
items: [
{
type: 'autogenerated',
dirName: 'aergia',
},
],
},
],
itemsxl: [
{
type: 'category',
Expand Down

0 comments on commit 9109132

Please sign in to comment.