feat: Add Dockerfile, .dockerignore, and CI workflow
Introduces a Dockerfile for building images, a .dockerignore file to exclude unnecessary files, and a GitHub Actions workflow for automatically building and pushing Docker images to GHCR upon release.
This commit is contained in:
parent
0c17cdb284
commit
a2f8eed254
|
|
@ -0,0 +1,4 @@
|
||||||
|
.idea
|
||||||
|
.venv
|
||||||
|
.git
|
||||||
|
.gitignore
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
name: Deploy Images to GHCR
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [created]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-push:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Login to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.repository_owner }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and Push Docker Image
|
||||||
|
env:
|
||||||
|
IMAGE_NAME: ${{ format('ghcr.io/{0}', github.repository) }}
|
||||||
|
run: |
|
||||||
|
docker build . --tag "${IMAGE_NAME}:${{ github.ref_name }}"
|
||||||
|
docker push "${IMAGE_NAME}:${{ github.ref_name }}"
|
||||||
|
docker tag "${IMAGE_NAME}:${{ github.ref_name }}" "${IMAGE_NAME}:latest"
|
||||||
|
docker push "${IMAGE_NAME}:latest"
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
FROM python:3.14-alpine
|
FROM python:3.14-alpine
|
||||||
|
LABEL org.opencontainers.image.source="https://github.com/mrmohebi/docker-hoster"
|
||||||
|
|
||||||
COPY requirements.txt /tmp/requirements.txt
|
COPY requirements.txt /tmp/requirements.txt
|
||||||
RUN pip3 install -r /tmp/requirements.txt
|
RUN pip3 install -r /tmp/requirements.txt
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue