diff --git a/.gitea/workflows/build-and-publish.yaml b/.gitea/workflows/build-and-publish.yaml new file mode 100644 index 0000000..0384fa9 --- /dev/null +++ b/.gitea/workflows/build-and-publish.yaml @@ -0,0 +1,50 @@ + +name: Build and publish container images + +on: +- workflow_dispatch + # push: + # branches: + # - master + +jobs: + build-and-publish: + runs-on: ubuntu-latest + container: + image: catthehacker/ubuntu:act-latest + steps: + - name: Check out the repo + uses: actions/checkout@v3 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Log in to the Container registry + uses: docker/login-action@v2 + with: + registry: gitea.jbrumond.me + username: ${{ secrets.REGISTRY_USER }} + password: ${{ secrets.REGISTRY_TOKEN }} + + - name: Build Container and publish + uses: docker/build-push-action@v4 + env: + # see + ACTIONS_RUNTIME_TOKEN: '' + with: + context: . + push: true + tags: | + gitea.jbrumond.me/doc-utils/docs-web:latest + platforms: | + linux/amd64 + linux/arm64 + # linux/riscv64 + # linux/arm/v7 + # linux/arm/v6 + build-args: | + DOC_UTILS_VERSION=0.2 + NGINX_VERSION=1.25 diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 4db5224..6cb2e9a 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -2,6 +2,7 @@ name: Build container images on: +# - workflow_dispatch push: branches: - master @@ -10,13 +11,31 @@ jobs: build: runs-on: ubuntu-latest container: - image: gitea.jbrumond.me/doc-utils/utils:0.2.0 + image: catthehacker/ubuntu:act-latest steps: - name: Check out the repo uses: actions/checkout@v3 - - name: Build docs to webpage - run: docs2website config.yaml + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 - - name: List files - run: ls -l www + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Build Container + uses: docker/build-push-action@v4 + env: + # see + ACTIONS_RUNTIME_TOKEN: '' + with: + context: . + push: false + platforms: | + linux/amd64 + linux/arm64 + # linux/riscv64 + # linux/arm/v7 + # linux/arm/v6 + build-args: | + DOC_UTILS_VERSION=0.2 + NGINX_VERSION=1.25 diff --git a/Dockerfile b/Dockerfile index e9f9345..1a4b694 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,21 @@ -FROM nginx +ARG DOC_UTILS_VERSION +ARG NGINX_VERSION + +FROM gitea.jbrumond.me/doc-utils/utils:${DOC_UTILS_VERSION} AS build_stage +WORKDIR /workspace + +# build website from source files +COPY docs layouts partials config.yaml metadata.json /workspace/ +RUN docs2website config.yaml + + + +FROM nginx:${NGINX_VERSION} AS deploy_stage EXPOSE 80 -# actual web content -COPY www/ /usr/share/nginx/html +# copy actual web content built above +COPY --from=build_stage /workspace/www/ /usr/share/nginx/html RUN chmod -R +rX /usr/share/nginx/html # nginx config files