Update docker stuff
Some checks failed
Build dev on push / build-api (push) Successful in 54s
Build dev on push / build-web (push) Successful in 1m14s
Build dev on push / build-redirector (push) Failing after 6s

This commit is contained in:
Sven Heidemann 2025-01-09 20:08:13 +01:00
parent ea3d1ec561
commit 39f468cc8a
4 changed files with 69 additions and 2 deletions

View File

@ -31,6 +31,31 @@ jobs:
run: |
docker push git.sh-edraft.de/sh-edraft.de/open-redirect-api-dev:$(cat version.txt)
build-redirector:
runs-on: [runner]
container: git.sh-edraft.de/sh-edraft.de/act-runner:latest
steps:
- name: Clone Repository
uses: https://github.com/actions/checkout@v3
with:
token: ${{ secrets.CI_ACCESS_TOKEN }}
- name: Build docker
run: |
cd api
docker build -f dockerfile_redirector -t git.sh-edraft.de/sh-edraft.de/open-redirect-redirector-dev:$(cat ../version.txt) .
- name: Login to registry git.sh-edraft.de
uses: https://github.com/docker/login-action@v1
with:
registry: git.sh-edraft.de
username: ${{ secrets.CI_USERNAME }}
password: ${{ secrets.CI_ACCESS_TOKEN }}
- name: Push image
run: |
docker push git.sh-edraft.de/sh-edraft.de/open-redirect-redirector-dev:$(cat version.txt)
build-web:
runs-on: [runner]
container: git.sh-edraft.de/sh-edraft.de/act-runner:latest
@ -53,7 +78,7 @@ jobs:
- name: Build docker
run: |
cd web
docker build -t git.sh-edraft.de/sh-edraft.de/open-redirect-web:$(cat ../version.txt) .
docker build -t git.sh-edraft.de/sh-edraft.de/open-redirect-web-dev:$(cat ../version.txt) .
- name: Login to registry git.sh-edraft.de
uses: https://github.com/docker/login-action@v1
@ -64,4 +89,4 @@ jobs:
- name: Push image
run: |
docker push git.sh-edraft.de/sh-edraft.de/open-redirect-web:$(cat version.txt)
docker push git.sh-edraft.de/sh-edraft.de/open-redirect-web-dev:$(cat version.txt)

View File

@ -3,6 +3,12 @@ FROM python:3.12.8-alpine
WORKDIR /app
COPY ./src/ .
RUN rm redirector
RUN rm redirector.py
RUN rm -r static
RUN rm -r templates
COPY ./requirements.txt .
RUN python -m pip install --upgrade pip

20
api/dockerfile_redirector Normal file
View File

@ -0,0 +1,20 @@
# syntax=docker/dockerfile:1
FROM python:3.12.8-alpine
WORKDIR /app
COPY ./src/core .
COPY ./src/data .
COPY ./src/redirector.py .
COPY ./src/redirector .
COPY ./requirements.txt .
RUN python -m pip install --upgrade pip
RUN python -m pip install -r requirements.txt
RUN apk update
RUN apk add bash
RUN apk add nano
CMD [ "bash", "/app/redirector"]

16
api/src/redirector Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash
if [[ $1 == "-dev" ]]; then
export ENVIRONMENT=development
export NAME=Open-redirect-dev
elif [[ $1 == "-stage" ]]; then
export ENVIRONMENT=staging
export NAME=Open-redirect-test
elif [[ $1 == "-prod" ]]; then
export ENVIRONMENT=production
export NAME=Open-redirect
fi
export PYTHONPATH=./:$PYTHONPATH
python3.12 redirector.py