commit efa677c43d0fcb1418f6aa09841a53fd772e39f7 Author: Nathan Woodburn Date: Thu Oct 30 12:10:38 2025 +1100 feat: Initial code drop diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml new file mode 100644 index 0000000..22fde30 --- /dev/null +++ b/.gitea/workflows/build.yml @@ -0,0 +1,46 @@ +name: Build Docker +run-name: Build Docker Images +on: + push: + +jobs: + BuildImage: + runs-on: [ubuntu-latest, amd] + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Install Docker + run : | + apt-get install ca-certificates curl gnupg + install -m 0755 -d /etc/apt/keyrings + curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg + chmod a+r /etc/apt/keyrings/docker.gpg + echo "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null + apt-get update + apt-get install docker-ce-cli -y + - name: Build Docker image + run : | + echo "${{ secrets.DOCKERGIT_TOKEN }}" | docker login git.woodburn.au -u nathanwoodburn --password-stdin + echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" + tag=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} + tag=${tag//\//-} + tag_num=${GITHUB_RUN_NUMBER} + echo "tag_num=$tag_num" + + if [[ "$tag" == "main" ]]; then + tag="latest" + else + tag_num="${tag}-${tag_num}" + fi + + repo=$GITHUB_REPOSITORY + repo=${repo#*/} + repo=$(echo $repo | tr '[:upper:]' '[:lower:]') + echo "container=$repo" + + + docker build -t $repo:$tag_num . + docker tag $repo:$tag_num git.woodburn.au/nathanwoodburn/$repo:$tag_num + docker push git.woodburn.au/nathanwoodburn/$repo:$tag_num + docker tag $repo:$tag_num git.woodburn.au/nathanwoodburn/$repo:$tag + docker push git.woodburn.au/nathanwoodburn/$repo:$tag diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..24962b0 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +# Start from a lightweight nginx base image +FROM nginx:alpine + +# Set environment variable with a default (can be overridden at runtime) +ENV REDIRECT_URL="https://example.com" + +# Copy in a custom nginx template +COPY default.conf.template /etc/nginx/templates/default.conf.template + +# Expose HTTP port +EXPOSE 80 diff --git a/default.conf.template b/default.conf.template new file mode 100644 index 0000000..c3afcc2 --- /dev/null +++ b/default.conf.template @@ -0,0 +1,8 @@ +server { + listen 80; + server_name _; + + location / { + return 302 $scheme://$REDIRECT_URL$request_uri; + } +}