Git workflow with Dockerfile
This commit is contained in:
parent
65283fc7f9
commit
b898dfd378
64
.gitea/workflow/build-python-app.yml
Normal file
64
.gitea/workflow/build-python-app.yml
Normal file
|
|
@ -0,0 +1,64 @@
|
||||||
|
name: Build Python App
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
pull_request:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY: hub.digitalhippo.tech
|
||||||
|
ORG_NAME: digitalhippo
|
||||||
|
IMAGE_NAME: wffrg
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: '3.11'
|
||||||
|
|
||||||
|
- name: Install requirements
|
||||||
|
run: |
|
||||||
|
python3 -m pip install --upgrade pip
|
||||||
|
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
||||||
|
|
||||||
|
- name: Lint with Ruff
|
||||||
|
run: |
|
||||||
|
pip install ruff
|
||||||
|
ruff format . --target-version=py311
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
- name: Login to Digital Hippo Labs Docker Hub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DIPPOLABS_USERNAME }}
|
||||||
|
password: ${{ secrets.DIPPOLABS_TOKEN }}
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
|
|
||||||
|
- name: Build Docker Image
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
push: true
|
||||||
|
tags: ${{ env.REGISTRY }}/${{ env.ORG_NAME }}-${{ env.IMAGE_NAME }}:latest
|
||||||
|
|
||||||
|
# - name: Update Service via Webhook
|
||||||
|
# uses: https://github.com/newarifrh/portainer-service-webhook@v1
|
||||||
|
# with:
|
||||||
|
# webhook_url: ${{ secrets.SERVICE_WEBHOOK_URL }}
|
||||||
|
|
||||||
|
# - name: Publish to Portainer
|
||||||
|
# uses: https://github.com/luminos-company/portami@v1.2
|
||||||
|
# with:
|
||||||
|
# endpoint: 'https://portainer.digitalhippo.tech'
|
||||||
|
# access_token: ${{ secrets.PORTAINER_ACCESS_KEY }}
|
||||||
|
# stack_name: ${{ secrets.PORTAINER_STACK_NAME }} # The unique name of the stack like: "cdn_minio"
|
||||||
|
# file_path: 'docker-compose.yml' # The stack file path to use
|
||||||
|
# prune: true # Prune the stack
|
||||||
|
# pull: true # Pull the images
|
||||||
20
Dockerfile
Normal file
20
Dockerfile
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
FROM python:3.11
|
||||||
|
|
||||||
|
WORKDIR /deployment
|
||||||
|
|
||||||
|
# Setup virtual environment
|
||||||
|
ENV VIRTUAL_ENV=/opt/venv
|
||||||
|
RUN python3 -m venv $VIRTUAL_ENV
|
||||||
|
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
|
||||||
|
|
||||||
|
# Install dependencies:
|
||||||
|
COPY requirements.txt .
|
||||||
|
RUN ["pip", "install", "-r", "requirements.txt"]
|
||||||
|
|
||||||
|
# Copy the application:
|
||||||
|
ADD service.py .
|
||||||
|
ADD config.py .
|
||||||
|
ADD app.py .
|
||||||
|
|
||||||
|
# Run the application:
|
||||||
|
CMD ["huey_consumer.py", "app.huey", "-k", "process", "-w", "2"]
|
||||||
Loading…
Reference in a new issue