feat: enhance CI/CD pipeline with build and push steps for Docker images
This commit is contained in:
@@ -32,6 +32,13 @@ jobs:
|
||||
# run: |
|
||||
# python -m flake8 web/ tests/ --max-line-length=120
|
||||
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
needs: test
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Build Docker image
|
||||
run: |
|
||||
docker build -t jobs-app .
|
||||
@@ -40,6 +47,23 @@ jobs:
|
||||
run: |
|
||||
docker run --rm jobs-app python -m pytest tests/ -v
|
||||
|
||||
push:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build, test]
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Push Docker image to gitea registry
|
||||
uses: docker/build-push-action@v4
|
||||
env:
|
||||
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
|
||||
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: git.allucanget.biz/allucanget/jobs-app:latest
|
||||
|
||||
# deploy:
|
||||
# runs-on: ubuntu-latest
|
||||
# needs: test
|
||||
|
||||
@@ -6,13 +6,10 @@ ENV PYTHONUNBUFFERED=1
|
||||
ENV PYTHONDONTWRITEBYTECODE=1
|
||||
ENV FLASK_ENV=production
|
||||
ENV FLASK_SECRET=production-secret-change-me
|
||||
ENV APT_CACHER_NG=http://192.168.88.14:3142
|
||||
|
||||
# Find location of apt sources list and change to a faster mirror
|
||||
RUN [ -f /etc/apt/sources.list ] && \
|
||||
echo "/etc/apt/sources.list exists, proceeding to modify it." \
|
||||
&& sed -i 's|http://deb.debian.org/debian|https://mirror.init7.net/debian|g' /etc/apt/sources.list \
|
||||
|| \
|
||||
(echo "/etc/apt/sources.list does not exist, exiting.")
|
||||
# Add apt-cacher-ng configuration
|
||||
RUN echo 'Acquire::http { Proxy "'"$APT_CACHER_NG"'/"; };' > /etc/apt/apt.conf.d/01proxy
|
||||
|
||||
# Install system dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
|
||||
Reference in New Issue
Block a user