php/.gitea/workflows/build_docker.yaml

54 lines
1.6 KiB
YAML
Raw Normal View History

2024-04-05 05:30:21 +00:00
name: Create Docker Image
run-name: ${{ gitea.actor }} Building Docker Image 🚀
on: [push]
jobs:
build:
name: Build Docker Image
runs-on: docker-x86
container:
image: docker:dind
privileged: true
env:
2024-04-07 01:03:24 +00:00
ARCH: x86_64
2024-04-05 05:30:21 +00:00
VERSION: 8.3-fpm
DOCKER_HOST: tcp://127.0.0.1:2375
VERSIONARCH: ${VERSION}-${ARCH}
steps:
2024-04-07 01:03:24 +00:00
- name: Environment Setup
2024-04-05 05:30:21 +00:00
run: |
2024-04-07 01:03:24 +00:00
# If we have a proxy use it
2024-04-05 05:30:21 +00:00
if [ -n "${HTTP_PROXY}" ]; then echo "HTTP PROXY [${HTTP_PROXY}]"; sed -i -e s'/https/http/' /etc/apk/repositories; fi
2024-04-07 01:03:24 +00:00
# Some pre-reqs
apk add git curl nodejs
# Start docker
2024-04-05 05:30:21 +00:00
( dockerd --host=tcp://0.0.0.0:2375 --tls=false & ) && sleep 3
2024-04-07 01:03:24 +00:00
## Some debugging info
# docker info && docker version
2024-04-05 05:30:21 +00:00
# env|sort
2024-04-07 01:03:24 +00:00
- name: Registry FQDN Setup
2024-04-05 05:30:21 +00:00
id: registry
run: |
registry=${{ github.server_url }}
2024-04-07 01:03:24 +00:00
echo "registry=${registry##http*://}" >> "$GITHUB_OUTPUT"
2024-04-05 05:30:21 +00:00
2024-04-07 01:03:24 +00:00
- name: Container Registry Login
2024-04-05 05:30:21 +00:00
uses: docker/login-action@v2
with:
registry: ${{ steps.registry.outputs.registry }}
username: ${{ gitea.actor }}
password: ${{ secrets.PKG_WRITE_TOKEN }}
2024-04-07 01:03:24 +00:00
- name: Code Checkout
uses: actions/checkout@v4
- name: Build and Push Docker Image
2024-04-05 05:30:21 +00:00
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
2024-04-07 01:03:24 +00:00
tags: "${{ steps.registry.outputs.registry }}/${{ env.GITHUB_REPOSITORY }}:${{ env.VERSIONARCH }}"