add dockerfile and gitea build action
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 2m55s
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 2m55s
This commit is contained in:
48
.gitea/workflows/build-and-push.yaml
Normal file
48
.gitea/workflows/build-and-push.yaml
Normal file
@@ -0,0 +1,48 @@
|
||||
name: Build and Push Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master # Trigger on push to the main branch; adjust as needed
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest # Use a runner with Docker support
|
||||
container: ghcr.io/catthehacker/ubuntu:act-latest # Image with Docker pre-installed
|
||||
steps:
|
||||
# Checkout the repository code
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set outputs
|
||||
id: vars
|
||||
run: |
|
||||
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
||||
|
||||
# Set up Docker Buildx for building the image
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
driver: remote
|
||||
endpoint: 'tcp://buildkitd:1234'
|
||||
|
||||
# Log in to the Gitea container registry
|
||||
- name: Log in to Gitea Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: git.dubyatp.xyz
|
||||
username: williamp
|
||||
password: ${{ secrets.REGISTRY_TOKEN }} # Personal Access Token for authentication
|
||||
|
||||
# Build and push the Docker image
|
||||
- name: Build and Push Docker Image
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: . # Build context (current directory)
|
||||
file: ./Dockerfile # Path to Dockerfile
|
||||
platforms: "linux/amd64,linux/arm64"
|
||||
push: true # Push to registry after building
|
||||
tags: |
|
||||
git.dubyatp.xyz/williamp/yt-dlp-bot:latest
|
||||
git.dubyatp.xyz/williamp/yt-dlp-bot:${{steps.vars.outputs.sha_short }}
|
||||
# Tags the image with 'latest' and the commit SHA
|
5
Dockerfile
Normal file
5
Dockerfile
Normal file
@@ -0,0 +1,5 @@
|
||||
FROM python:3.13.5-alpine3.22
|
||||
COPY ./app /app
|
||||
WORKDIR /app
|
||||
RUN pip install -r requirements.txt
|
||||
CMD ["python", "/app/main.py"]
|
Reference in New Issue
Block a user