add fname sort #48
This file contains 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: Create and publish a Docker image | |
# Configures this workflow to run every time a change is pushed to the branch called `main`. | |
on: | |
push: | |
branches: | |
- 'main' | |
tags: | |
- 'v*' | |
# Defines two custom environment variables for the workflow. These are used for | |
# the Container registry domain, and a name for the Docker image that this | |
# workflow builds. | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_BASE: photodirs | |
# There is a single job in this workflow. It's configured to run on the latest | |
# available version of Ubuntu. | |
jobs: | |
build-and-push-image: | |
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job. | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
# | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '18' | |
# Generate the default config (port 3333, admin=true) | |
- run: bin/gen-config | |
# Uses the `docker/login-action` action to log in to the Container | |
# registry registry using the account and password that will publish the | |
# packages. Once published, the packages are scoped to the account | |
# defined here. | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
## NGINX CONTAINER | |
- name: nginx Docker meta | |
id: nginx_meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
${{ env.REGISTRY }}/zsteinkamp/${{ env.IMAGE_BASE }}-nginx | |
tags: | | |
type=raw,value=latest | |
type=sha | |
- name: nginx Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
file: ./Dockerfile.nginx | |
context: . | |
push: true | |
tags: ${{ steps.nginx_meta.outputs.tags }} | |
platforms: linux/amd64,linux/arm64 | |
labels: ${{ steps.nginx_meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
## FRONTEND CONTAINER | |
- name: frontend Docker meta | |
id: frontend_meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
${{ env.REGISTRY }}/zsteinkamp/${{ env.IMAGE_BASE }}-frontend | |
tags: | | |
type=raw,value=latest | |
type=sha | |
- name: frontend Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
file: ./frontend/Dockerfile.gh | |
context: frontend/ | |
target: prod | |
push: true | |
tags: ${{ steps.frontend_meta.outputs.tags }} | |
platforms: linux/amd64,linux/arm64 | |
labels: ${{ steps.frontend_meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
## API CONTAINER | |
- name: api Docker meta | |
id: api_meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
${{ env.REGISTRY }}/zsteinkamp/${{ env.IMAGE_BASE }}-api | |
tags: | | |
type=raw,value=latest | |
type=sha | |
- name: api Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
file: ./backend/Dockerfile.gh | |
context: backend/ | |
target: api | |
push: true | |
tags: ${{ steps.api_meta.outputs.tags }} | |
platforms: linux/amd64,linux/arm64 | |
labels: ${{ steps.api_meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
## WATCHER CONTAINER | |
- name: watcher Docker meta | |
id: watcher_meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
${{ env.REGISTRY }}/zsteinkamp/${{ env.IMAGE_BASE }}-watcher | |
tags: | | |
type=raw,value=latest | |
type=sha | |
- name: watcher Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
file: ./backend/Dockerfile.gh | |
context: backend/ | |
target: watcher | |
push: true | |
tags: ${{ steps.watcher_meta.outputs.tags }} | |
platforms: linux/amd64,linux/arm64 | |
labels: ${{ steps.watcher_meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
## ADMIN CONTAINER | |
- name: admin Docker meta | |
id: admin_meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
${{ env.REGISTRY }}/zsteinkamp/${{ env.IMAGE_BASE }}-admin | |
tags: | | |
type=raw,value=latest | |
type=sha | |
- name: admin Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
file: ./backend/Dockerfile.gh | |
context: backend/ | |
target: admin | |
push: true | |
tags: ${{ steps.admin_meta.outputs.tags }} | |
platforms: linux/amd64,linux/arm64 | |
labels: ${{ steps.admin_meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |