73 lines
2.7 KiB
YAML
73 lines
2.7 KiB
YAML
name: Build and Push Docker Image to Gitea Registry
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- Setup-Basic-Website
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
branch:
|
|
- main
|
|
- Setup-Basic-Website
|
|
|
|
jobs:
|
|
build-and-push:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Login to Gitea Registry
|
|
run: |
|
|
echo "${{ secrets.TOKEN }}" | docker login ${{ gitea.server_url }} --username ${{ gitea.actor }} --password-stdin
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
- name: Build and push Docker image (from docker-compose)
|
|
id: docker_build
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
provenance: false
|
|
context: .
|
|
file: ./Dockerfile # Ensure your Dockerfile is correctly referenced from your compose file.
|
|
push: true
|
|
tags: gitea.bsidesolutions.net/${{ gitea.repository }}:${{ gitea.sha }}
|
|
build-args: |
|
|
SMTP_PROXY_EMAIL=${{secrets.SMTP_PROXY_EMAIL}}
|
|
SMTP_RECIPIENT_EMAIL=${{secrets.SMTP_RECIPIENT_EMAIL}}
|
|
SMTP_HOST=${{secrets.SMTP_HOST}}
|
|
SMTP_PORT=${{secrets.SMTP_PORT}}
|
|
SMTP_USERNAME=${{secrets.SMTP_USERNAME}}
|
|
SMTP_PASSWORD=${{secrets.SMTP_PASSWORD}}
|
|
NEXT_PUBLIC_GOOGLE_APPOINTMENTS_LINK=${{secrets.NEXT_PUBLIC_GOOGLE_APPOINTMENTS_LINK}}
|
|
RECAPTCHA_SECRET_KEY=${{secrets.RECAPTCHA_SECRET_KEY}}
|
|
NEXT_PUBLIC_RECAPTCHA_SITE_KEY=${{secrets.NEXT_PUBLIC_RECAPTCHA_SITE_KEY}}
|
|
|
|
- name: Push latest tag (optional)
|
|
if: github.ref == 'refs/heads/main'
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
provenance: false
|
|
context: .
|
|
file: ./Dockerfile
|
|
push: true
|
|
tags: ${{ gitea.server_url }}/${{ gitea.repository }}:latest
|
|
build-args: |
|
|
SMTP_PROXY_EMAIL=${{secrets.SMTP_PROXY_EMAIL}}
|
|
SMTP_RECIPIENT_EMAIL=${{secrets.SMTP_RECIPIENT_EMAIL}}
|
|
SMTP_HOST=${{secrets.SMTP_HOST}}
|
|
SMTP_PORT=${{secrets.SMTP_PORT}}
|
|
SMTP_USERNAME=${{secrets.SMTP_USERNAME}}
|
|
SMTP_PASSWORD=${{secrets.SMTP_PASSWORD}}
|
|
NEXT_PUBLIC_GOOGLE_APPOINTMENTS_LINK=${{secrets.NEXT_PUBLIC_GOOGLE_APPOINTMENTS_LINK}}
|
|
RECAPTCHA_SECRET_KEY=${{secrets.RECAPTCHA_SECRET_KEY}}
|
|
NEXT_PUBLIC_RECAPTCHA_SITE_KEY=${{secrets.NEXT_PUBLIC_RECAPTCHA_SITE_KEY}}
|
|
|
|
- name: Display Image details
|
|
run: |
|
|
echo "Image pushed: ${{ gitea.server_url }}/${{ gitea.repository }}:${{ gitea.sha }}"
|
|
echo "Image pushed: ${{ gitea.server_url }}/${{ gitea.repository }}:latest" |