Update nginx configuration to set inactive cache duration to 365 days #81
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Docker Image CI | |
| on: | |
| push: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Extract metadata | |
| id: meta | |
| run: | | |
| if [[ $GITHUB_REF == refs/tags/* ]]; then | |
| TAG=${GITHUB_REF#refs/tags/} | |
| else | |
| TAG=${GITHUB_REF#refs/heads/} | |
| fi | |
| echo "tag=$TAG" >> $GITHUB_OUTPUT | |
| - name: Test NGINX configuration | |
| env: | |
| UPSTREAM_SERVER: owl.virtualflybrain.org:80 | |
| CACHE_MAX_SIZE: 20g | |
| DNS_RESOLVER: 8.8.8.8 | |
| run: | | |
| envsubst '${UPSTREAM_SERVER} ${CACHE_MAX_SIZE} ${DNS_RESOLVER}' < nginx.conf.template > test-nginx.conf | |
| docker run --rm -v $(pwd)/test-nginx.conf:/tmp/nginx.conf nginx:1.26-alpine nginx -t -c /tmp/nginx.conf | |
| - name: Build test Docker image | |
| run: docker build --no-cache . --file Dockerfile --tag test-image | |
| - name: Test container startup | |
| env: | |
| UPSTREAM_SERVER: owl.virtualflybrain.org:80 | |
| CACHE_MAX_SIZE: 20g | |
| DNS_RESOLVER: 8.8.8.8 | |
| run: | | |
| docker run -d --name test-container \ | |
| -e UPSTREAM_SERVER \ | |
| -e CACHE_MAX_SIZE \ | |
| -e DNS_RESOLVER \ | |
| test-image | |
| sleep 5 | |
| if docker ps | grep -q test-container; then | |
| echo "Container is running successfully" | |
| else | |
| echo "Container failed to start" | |
| docker logs test-container | |
| exit 1 | |
| fi | |
| docker stop test-container || true | |
| docker rm test-container | |
| - name: Build Docker image | |
| run: docker build . --file Dockerfile --tag virtualflybrain/owl_cache:${{ steps.meta.outputs.tag }} | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_HUB_USER }} | |
| password: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
| - name: Push Docker image | |
| run: docker push virtualflybrain/owl_cache:${{ steps.meta.outputs.tag }} |