Compare commits
12
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4d728c8e68 | ||
|
|
ef3aed4ba2 | ||
|
|
8f30fdb88c | ||
|
|
d4b67906cd | ||
|
|
075fa32ea2 | ||
|
|
f71f678662 | ||
|
|
457857df32 | ||
|
|
49adc84f5c | ||
|
|
a2a9a8c3a0 | ||
|
|
a62db898aa | ||
|
|
a2a6e5c5fe | ||
|
|
b9307efba2 |
@@ -0,0 +1,16 @@
|
|||||||
|
FROM gitea.tryton.geeraert.eu/pi-ux-ce/python:3
|
||||||
|
|
||||||
|
ENV PYTHONUNBUFFERED 1
|
||||||
|
|
||||||
|
WORKDIR /code/
|
||||||
|
|
||||||
|
# Copy only the requirements file first (Changes infrequently)
|
||||||
|
COPY requirements.txt ./
|
||||||
|
|
||||||
|
|
||||||
|
RUN --mount=type=cache,target=/root/.cache/pip pip install --upgrade pip
|
||||||
|
RUN --mount=type=cache,target=/root/.cache/pip pip list --outdated
|
||||||
|
RUN --mount=type=cache,target=/root/.cache/pip pip install --upgrade wheel
|
||||||
|
RUN --mount=type=cache,target=/root/.cache/pip pip install --upgrade setuptools
|
||||||
|
RUN --mount=type=cache,target=/root/.cache/pip pip install -r requirements.txt
|
||||||
|
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
django
|
||||||
|
psycopg2
|
||||||
|
requests
|
||||||
|
proxmoxer
|
||||||
|
docker
|
||||||
|
kubernetes
|
||||||
|
ruamel.yaml
|
||||||
|
pyyaml
|
||||||
|
django-bootstrap-v5
|
||||||
|
jinja2
|
||||||
|
watchdog
|
||||||
|
celery
|
||||||
|
redis
|
||||||
|
lxml
|
||||||
|
requests
|
||||||
@@ -2,10 +2,89 @@ name: Gitea Actions Demo
|
|||||||
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
|
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
#paths-ignore:
|
||||||
|
# - 'requirements.txt'
|
||||||
issue_comment:
|
issue_comment:
|
||||||
types: [created]
|
types: [created]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
# Job to check for file changes and set an output
|
||||||
|
changes:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
requirements_changed: ${{ steps.filter.outputs.requirements }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: dorny/paths-filter@v3
|
||||||
|
id: filter
|
||||||
|
with:
|
||||||
|
filters: |
|
||||||
|
requirements:
|
||||||
|
- 'requirements.txt'
|
||||||
|
|
||||||
|
Build-dockerfile:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: changes
|
||||||
|
if: ${{ needs.changes.outputs.requirements_changed == 'true' }}
|
||||||
|
steps:
|
||||||
|
- run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
|
||||||
|
- name: Check out repository code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner."
|
||||||
|
- name: List files in the repository
|
||||||
|
run: |
|
||||||
|
ls ${{ gitea.workspace }}
|
||||||
|
|
||||||
|
- name: Compute next version
|
||||||
|
id: versioning
|
||||||
|
run: |
|
||||||
|
latest="${{ vars.PYTHON_VERSION }}"
|
||||||
|
next_version=$(echo "$latest" | awk -F. -v OFS=. '{$NF += 1 ; print}')
|
||||||
|
echo "next_version=$next_version" >> $GITHUB_ENV
|
||||||
|
echo "Variables used :"
|
||||||
|
echo "------------------------------------------------"
|
||||||
|
echo "Next version: $next_version"
|
||||||
|
|
||||||
|
- uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: /root/.cache/pip
|
||||||
|
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
|
|
||||||
|
- name: inject cache into docker
|
||||||
|
uses: reproducible-containers/buildkit-cache-dance@v3.1.0
|
||||||
|
with:
|
||||||
|
cache-source: /root/.cache/pip
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Login to gitea
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: gitea.tryton.geeraert.eu
|
||||||
|
username: ${{ secrets.USERNAME_GITEA }}
|
||||||
|
password: ${{ secrets.PASSWORD_GITEA }}
|
||||||
|
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: "{{defaultContext}}:.gitea/python_build"
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
gitea.tryton.geeraert.eu/pi-ux-ce/modified-python:latest
|
||||||
|
gitea.tryton.geeraert.eu/pi-ux-ce/modified-python:${{ env.next_version }}
|
||||||
|
cache-from: type=registry,ref=gitea.tryton.geeraert.eu/pi-ux-ce/modified-python:buildcache
|
||||||
|
cache-to: type=registry,ref=gitea.tryton.geeraert.eu/pi-ux-ce/modified-python:buildcache,mode=max
|
||||||
|
|
||||||
|
- name: update version in the variable
|
||||||
|
run: |
|
||||||
|
curl -X PUT -H "Content-Type: application/json" \
|
||||||
|
--user ${{ secrets.USERNAME_GITEA }}:${{ secrets.PASSWORD_GITEA }} \
|
||||||
|
https://gitea.tryton.geeraert.eu/api/v1/repos/pi-ux-ce/${{ github.event.repository.name }}/actions/variables/PYTHON_VERSION \
|
||||||
|
-d "{\"Value\":\"$next_version\"}"
|
||||||
Explore-Gitea-Actions:
|
Explore-Gitea-Actions:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
@@ -29,7 +108,7 @@ jobs:
|
|||||||
|
|
||||||
- uses: actions/cache@v3
|
- uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: ~/.cache/pip
|
path: /root/.cache/pip
|
||||||
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
|
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|||||||
@@ -3,3 +3,4 @@
|
|||||||
venv/*
|
venv/*
|
||||||
*__pycache__*
|
*__pycache__*
|
||||||
Webcal-python/*
|
Webcal-python/*
|
||||||
|
.idea/*
|
||||||
|
|||||||
+1
-11
@@ -1,19 +1,9 @@
|
|||||||
FROM gitea.tryton.geeraert.eu/pi-ux-ce/python:3
|
FROM gitea.tryton.geeraert.eu/pi-ux-ce/modified-python:latest
|
||||||
|
|
||||||
ENV PYTHONUNBUFFERED 1
|
ENV PYTHONUNBUFFERED 1
|
||||||
|
|
||||||
WORKDIR /code/
|
WORKDIR /code/
|
||||||
|
|
||||||
# Copy only the requirements file first (Changes infrequently)
|
|
||||||
COPY requirements.txt ./
|
|
||||||
|
|
||||||
|
|
||||||
RUN --mount=type=cache,target=/root/.cache/pip pip install --upgrade pip
|
|
||||||
RUN --mount=type=cache,target=/root/.cache/pip pip list --outdated
|
|
||||||
RUN --mount=type=cache,target=/root/.cache/pip pip install --upgrade wheel
|
|
||||||
RUN --mount=type=cache,target=/root/.cache/pip pip install --upgrade setuptools
|
|
||||||
RUN --mount=type=cache,target=/root/.cache/pip pip install -r requirements.txt
|
|
||||||
|
|
||||||
# Copy the rest of your application code (Changes frequently, invalidates subsequent cache)
|
# Copy the rest of your application code (Changes frequently, invalidates subsequent cache)
|
||||||
COPY . ./
|
COPY . ./
|
||||||
RUN python django_code/manage.py migrate
|
RUN python django_code/manage.py migrate
|
||||||
|
|||||||
Reference in New Issue
Block a user