From 56e7e3b203a72be47f463b90ca5eda8884f57e6a Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 16 Nov 2024 13:57:42 +0100 Subject: [PATCH 1/2] Build Docker image --- Dockerfile | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..dd3a247 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM node:23 AS build +ENV FORCE_COLOR=0 +RUN corepack enable +WORKDIR /opt/docusaurus + +WORKDIR /opt/docusaurus +COPY . /opt/docusaurus/ +RUN npm ci +RUN npm run build + +FROM nginx:alpine +COPY --from=build /opt/docusaurus/build /usr/share/nginx/html +EXPOSE 80 \ No newline at end of file From 7c663e41d8ccb3864eafafdeebe5af54e3a54782 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 16 Nov 2024 13:58:08 +0100 Subject: [PATCH 2/2] Include Gitea action to build Docker image --- .gitea/workflows/build.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .gitea/workflows/build.yml diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml new file mode 100644 index 0000000..16e72bb --- /dev/null +++ b/.gitea/workflows/build.yml @@ -0,0 +1,33 @@ +name: Build Nginx-based docker image +on: + push: + branches: + - main + pull_request: +jobs: + build-static-assets: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to the private Docker registry + uses: docker/login-action@v3 + with: + registry: ${{ secrets.PRIVATE_REGISTRY_HOST }} + username: ${{ secrets.PRIVATE_REGISTRY_USERNAME }} + password: ${{ secrets.PRIVATE_REGISTRY_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: | + ${{ secrets.PRIVATE_REGISTRY_HOST }}/${{ env.GITHUB_REPOSITORY }}:latest + cache-from: type=registry,ref=user/app:latest + cache-to: type=inline \ No newline at end of file