Compare commits
2
Commits
ca3f7e964e
...
632ba5257e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
632ba5257e | ||
|
|
7127effdaf |
@@ -0,0 +1,62 @@
|
|||||||
|
name: Gitea Actions Demo
|
||||||
|
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- "*"
|
||||||
|
paths:
|
||||||
|
- 'django_testing/dockerfile'
|
||||||
|
tags-ignore:
|
||||||
|
- '*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
Explore-Gitea-Actions:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
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: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Compute next version
|
||||||
|
id: versioning
|
||||||
|
run: |
|
||||||
|
latest="${{ vars.VERSION_TESTING }}"
|
||||||
|
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"
|
||||||
|
|
||||||
|
|
||||||
|
- 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: django_testing/
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
gitea.tryton.geeraert.eu/pi-ux-ce/django-testing:latest
|
||||||
|
gitea.tryton.geeraert.eu/pi-ux-ce/django-testing:${{ env.next_version }}
|
||||||
|
cache-from: type=registry,ref=gitea.tryton.geeraert.eu/pi-ux-ce/geoip2-nginx:buildcache
|
||||||
|
cache-to: type=registry,ref=gitea.tryton.geeraert.eu/pi-ux-ce/geoip2-nginx: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/VERSION_TESTING \
|
||||||
|
-d "{\"Value\":\"$next_version\"}"
|
||||||
|
|
||||||
|
- run: echo "🍏 This job's status is ${{ job.status }}."
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
# Stage 1: Build the module
|
||||||
|
FROM python:3
|
||||||
|
|
||||||
|
ENV PYTHONUNBUFFERED 1
|
||||||
|
|
||||||
|
WORKDIR /code/
|
||||||
|
|
||||||
|
# Install build tools and MaxMind library
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y git && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Clone the specific GeoIP2 module project
|
||||||
|
RUN git clone https://gitea.tryton.geeraert.eu/pi-ux-ce/Django_kube.git
|
||||||
|
|
||||||
|
RUN pip install --cache-dir=/opt/hostedtoolcache/pip --upgrade pip
|
||||||
|
RUN pip list --cache-dir=/opt/hostedtoolcache/pip --outdated
|
||||||
|
RUN pip install --cache-dir=/opt/hostedtoolcache/pip --upgrade wheel
|
||||||
|
RUN pip install --cache-dir=/opt/hostedtoolcache/pip --upgrade setuptools
|
||||||
|
RUN pip install --cache-dir=/opt/hostedtoolcache/pip -r Django_kube/requirements.txt
|
||||||
|
|
||||||
|
RUN python Django_kube/django_code/manage.py migrate
|
||||||
|
|
||||||
|
COPY entrypoint.sh /code/entrypoint.sh
|
||||||
|
RUN chmod +x /code/entrypoint.sh
|
||||||
|
|
||||||
|
EXPOSE 8000
|
||||||
|
|
||||||
|
ENTRYPOINT ["/code/entrypoint.sh"]
|
||||||
|
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
cd Django_kube
|
||||||
|
|
||||||
|
#another methid but needs to rm -rf before
|
||||||
|
#git clone --depth 1 -b main https://gitea.tryton.geeraert.eu/pi-ux-ce/Django_kube.git
|
||||||
|
|
||||||
|
git pull
|
||||||
|
|
||||||
|
pip install -r requirements.txt
|
||||||
|
|
||||||
|
python django_code/manage.py migrate
|
||||||
|
|
||||||
|
python django_code/manage.py runserver "0.0.0.0:8000"
|
||||||
|
|
||||||
Reference in New Issue
Block a user