Skip to content

Commit

Permalink
Add static file server
Browse files Browse the repository at this point in the history
  • Loading branch information
eliotjordan committed Aug 20, 2024
1 parent 5cd5269 commit c583037
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/build-docker-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 4 additions & 0 deletions static/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ARG VERSION=1.26.2
FROM cupcakearmy/static:$VERSION

COPY ./default.conf /usr/local/nginx/conf/sites/default.conf
11 changes: 11 additions & 0 deletions static/default.conf
Original file line number Diff line number Diff line change
@@ -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;
}
}

0 comments on commit c583037

Please sign in to comment.