Skip to content

Commit

Permalink
Use ghcr.io/dtcooper/nginx-certbot-jinja container
Browse files Browse the repository at this point in the history
  • Loading branch information
dtcooper committed Oct 17, 2024
1 parent 9a0c778 commit d997a32
Show file tree
Hide file tree
Showing 10 changed files with 8 additions and 101 deletions.
12 changes: 2 additions & 10 deletions .github/actions/docker-build-push/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ inputs:
description: Do not use cache when building
required: false
default: 'false'
cache-tag:
description: "Tag to use for cache when building (default '<container>-<tag>'). Disabled when 'push: false'"
required: false
default: ''
build-args:
description: List of build-time variables
required: false
Expand All @@ -45,11 +41,7 @@ runs:
run: |
USERNAME="$(echo "$GITHUB_REPOSITORY_OWNER" | tr '[:upper:]' '[:lower:]')"
CACHE_CONTAINER=ghcr.io/${USERNAME}/tomato-build-cache
if [ "${{ inputs.cache-tag }}" ]; then
CACHE_TAG="${CACHE_CONTAINER}:${{ inputs.cache-tag }}"
else
CACHE_TAG="${CACHE_CONTAINER}:${{ inputs.container }}-${{ inputs.tag }}"
fi
CACHE_TAG="${CACHE_CONTAINER}:${{ inputs.container }}-${{ inputs.tag }}"
echo "CACHE_TAG=${CACHE_TAG}" | tee -a "${GITHUB_ENV}"
echo "REPO=ghcr.io/${USERNAME}/tomato-${{ inputs.container }}" | tee -a "${GITHUB_ENV}"
echo "USERNAME=${USERNAME}" | tee -a "${GITHUB_ENV}"
Expand All @@ -73,7 +65,7 @@ runs:
push: ${{ inputs.push == 'true' && 'true' || 'false'}}
pull: true
platforms: ${{ inputs.platforms }}
context: ./${{ inputs.context == '' && inputs.container || inputs.context }}/
context: ./${{ inputs.container }}/
tags: ${{ env.REPO }}:${{ inputs.tag }}
build-args: ${{ inputs.build-args }}
cache-from: ${{ inputs.no-cache == 'false' && inputs.push == 'true' && format('type=registry,ref={0}', env.CACHE_TAG) || '' }}
Expand Down
23 changes: 1 addition & 22 deletions .github/workflows/build-deploy-on-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,18 @@ jobs:
name: Build container
strategy:
matrix:
include:
-
container: server
tag: dev
-
container: server
tag: latest
-
container: nginx
tag: latest
tag: [dev, latest]
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Get version
id: version
if: matrix.container == 'server'
uses: ./.github/actions/version
-
name: Build container (server)
uses: ./.github/actions/docker-build-push
if: matrix.container == 'server'
with:
token: ${{ secrets.GITHUB_TOKEN }}
container: server
Expand All @@ -52,16 +41,6 @@ jobs:
build-args: |
DEBUG=${{ matrix.tag == 'dev' && '1' || '0' }}
TOMATO_VERSION=${{ steps.version.outputs.version }}
-
name: Build container (nginx)
uses: ./.github/actions/docker-build-push
if: matrix.container == 'nginx'
with:
token: ${{ secrets.GITHUB_TOKEN }}
container: nginx
context: server/nginx
push: ${{ github.ref_name == 'main' && 'true' || 'false' }}
tag: ${{ matrix.tag }}
deploy:
Expand Down
16 changes: 0 additions & 16 deletions .github/workflows/build-deploy-on-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,17 @@ jobs:
build:
runs-on: ubuntu-22.04
name: Build container
strategy:
matrix:
container: [server, nginx]
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Get version
id: version
if: matrix.container == 'server'
uses: ./.github/actions/version
-
name: Set variables
shell: bash
if: matrix.container == 'server'
run: |
DATE=$(date +%Y%m%d)
YEAR=$(date +%Y)
Expand All @@ -43,7 +38,6 @@ jobs:
-
name: Build container
uses: ./.github/actions/docker-build-push
if: matrix.container == 'server'
with:
token: ${{ secrets.GITHUB_TOKEN }}
container: server
Expand All @@ -52,16 +46,6 @@ jobs:
platforms: ${{ env.PLATFORMS }}
build-args: |
TOMATO_VERSION=${{ steps.version.outputs.version }}
-
name: Build container (nginx)
uses: ./.github/actions/docker-build-push
if: matrix.container == 'nginx'
with:
token: ${{ secrets.GITHUB_TOKEN }}
container: nginx
context: server/nginx
cache-tag: nginx-latest
tag: ${{ github.ref_name }}
deploy:
runs-on: ubuntu-22.04
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ scratch/
__pycache__/
/server/.env
/server/docker-compose.override.yml
/server/nginx/local-ca/
/server/local-ca/
/server/serve/
/server/tomato/static/vendor/node_modules/

Expand Down
1 change: 1 addition & 0 deletions server/.dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/tomato/static/vendor/node_modules/
/local-ca/
4 changes: 1 addition & 3 deletions server/docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ services:
nginx:
restart: 'no'
volumes:
- ./nginx/local-ca:/etc/local_ca
- ./nginx/image/docker-entrypoint.d/25-jinja2-on-templates.sh:/docker-entrypoint.d/25-jinja2-on-templates.sh
- ./nginx/image/etc/nginx/templates/app.conf.j2:/etc/nginx/templates/app.conf.j2
- ./local-ca:/etc/local_ca
environment:
USE_LOCAL_CA: "${NGINX_DEBUG_MODE_ONLY_USE_LOCAL_CA:-0}"
LOCAL_CA_ROOT_CERT_VALIDITY: 90 # 90 days instead of 30
Expand Down
5 changes: 2 additions & 3 deletions server/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,13 @@ services:

nginx:
restart: always
image: "ghcr.io/dtcooper/tomato-nginx:${TOMATO_VERSION:-latest}"
build:
context: nginx
image: ghcr.io/dtcooper/nginx-certbot-jinja:5.4.0-nginx1.27.2
depends_on:
- app
- api
- logs
volumes:
- ./nginx.conf.j2:/etc/nginx/templates/app.conf.j2
- ./serve:/serve:ro
- nginx_secrets:/etc/letsencrypt
environment:
Expand Down
File renamed without changes.
11 changes: 0 additions & 11 deletions server/nginx/Dockerfile

This file was deleted.

35 changes: 0 additions & 35 deletions server/nginx/image/docker-entrypoint.d/25-jinja2-on-templates.sh

This file was deleted.

0 comments on commit d997a32

Please sign in to comment.