FileServer/.github/workflows/docker.yml
netkas 72da412737
Some checks failed
Docker CI/CD / build-and-save (push) Has been cancelled
Docker CI/CD / build-and-push (push) Has been cancelled
CI / release (push) Has been cancelled
CI / debug (push) Has been cancelled
CI / release_executable (push) Has been cancelled
CI / debug_executable (push) Has been cancelled
CI / check-phpunit (push) Has been cancelled
CI / check-phpdoc (push) Has been cancelled
CI / generate-phpdoc (push) Has been cancelled
CI / test (push) Has been cancelled
CI / release-documentation (push) Has been cancelled
CI / release-artifacts (push) Has been cancelled
Add configuration classes, enums, and database handling for FileServer
2025-05-15 21:05:40 -04:00

76 lines
No EOL
2.1 KiB
YAML

name: Docker CI/CD
on:
push:
branches:
- '**'
release:
types:
- published
permissions:
packages: write
contents: read
jobs:
build-and-save:
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build Docker image
run: |
IMAGE_NAME=$(echo ${{ github.repository }} | cut -d'/' -f2)
docker build -t $IMAGE_NAME:${{ github.sha }} .
- name: Save Docker image as .tar artifact
run: |
IMAGE_NAME=$(echo ${{ github.repository }} | cut -d'/' -f2)
docker save $IMAGE_NAME:${{ github.sha }} > docker-image-${{ github.sha }}.tar
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: docker-image-${{ github.sha }}
path: docker-image-${{ github.sha }}.tar
build-and-push:
runs-on: ubuntu-latest
if: github.event_name == 'release'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
registry: docker.io
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
tags: |
ghcr.io/${{ github.repository }}:${{ github.event.release.tag_name }}
ghcr.io/${{ github.repository }}:latest
docker.io/your-dockerhub-username:${{ github.event.release.tag_name }}
docker.io/your-dockerhub-username:latest
push: true