diff --git a/.github/workflows/build-docker-images.yml b/.github/workflows/build-docker-images.yml index ccf1131..ec3eadb 100644 --- a/.github/workflows/build-docker-images.yml +++ b/.github/workflows/build-docker-images.yml @@ -110,3 +110,52 @@ jobs: tags: | ghcr.io/geoblacklight/solr:${{ steps.package_version.outputs.version }} ghcr.io/geoblacklight/solr:latest + + build-static-docker: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Get version from dockerfile + id: package_version + run: echo "version=$(grep -Pio '(?<=ARG VERSION=).*' ./static/Dockerfile)" >> $GITHUB_OUTPUT + + # On pull request + - name: Build and push static file server Docker image with version tag + uses: docker/build-push-action@v6 + if: github.event_name == 'pull_request' + with: + context: "${{ github.workspace }}/static/" + file: "${{ github.workspace }}/static/Dockerfile" + push: true + platforms: linux/amd64,linux/arm64 + cache-from: type=gha + cache-to: type=gha,mode=max + tags: ghcr.io/geoblacklight/static:${{ steps.package_version.outputs.version }}-dev + + # On push to main + - name: Build and push static file server Docker image with version and latest tags + uses: docker/build-push-action@v6 + if: github.event_name == 'workflow_dispatch' || github.event_name == 'push' + with: + context: "${{ github.workspace }}/static/" + file: "${{ github.workspace }}/static/Dockerfile" + push: true + platforms: linux/amd64,linux/arm64 + cache-from: type=gha + cache-to: type=gha,mode=max + tags: | + ghcr.io/geoblacklight/static:${{ steps.package_version.outputs.version }} + ghcr.io/geoblacklight/static:latest diff --git a/static/Dockerfile b/static/Dockerfile new file mode 100644 index 0000000..a7facd5 --- /dev/null +++ b/static/Dockerfile @@ -0,0 +1,4 @@ +ARG VERSION=1.26.2 +FROM cupcakearmy/static:$VERSION + +COPY ./default.conf /usr/local/nginx/conf/sites/default.conf diff --git a/static/default.conf b/static/default.conf new file mode 100644 index 0000000..20238ea --- /dev/null +++ b/static/default.conf @@ -0,0 +1,11 @@ +server { + listen 80; + server_name _; + + location / { + root /srv; + add_header Access-Control-Allow-Origin *; + index index.html; + try_files $uri $uri/ /index.html?$args; + } +}