Skip to content

Commit

Permalink
Add Woodpecker CI config
Browse files Browse the repository at this point in the history
  • Loading branch information
Allypost committed Nov 18, 2024
1 parent 9f39235 commit 48d470e
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 4 deletions.
5 changes: 4 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
.vscode
.git
.woodpecker
.dockerignore
Dockerfile
compose.yaml
ui
db.sqlite3
db.sqlite3
64 changes: 64 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: build

on:
push:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build-frontend:
runs-on: [self-hosted]
steps:
- uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
if: github.event_name != 'pull_request'
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Testerino
run: |
env
exit 1
- name: Build and push
uses: docker/build-push-action@v6
with:
context: ./ui
push: github.event_name != 'pull_request'
pull: true
tags: |
ksetcomp/brucifer-karte-2022:latest
ksetcomp/brucifer-karte-2022:${{ github.ref }}
build-backend:
runs-on: [self-hosted]
steps:
- uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
if: github.event_name != 'pull_request'
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build backend container
run: |
pwd;
env;
ls -allah
notify-watchtower:
runs-on: [self-hosted]
needs: [build-frontend, build-backend]
steps:
- name: Notify Watchtower
run: |
curl -sL -v \
--header 'Authorization: Bearer ${{ secrets.WATCHTOWER_TOKEN }}' \
"${{ vars.WATCHTOWER_URL }}/v1/update"
10 changes: 10 additions & 0 deletions .woodpecker/.env.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
when:
- event: push
# branch: ${CI_REPO_DEFAULT_BRANCH}

steps:
- name: env
image: alpine
commands:
- env
38 changes: 38 additions & 0 deletions .woodpecker/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
depends_on:
- env

when:
- event: push
# branch: ${CI_REPO_DEFAULT_BRANCH}

steps:
- name: build
image: docker
environment:
_DOCKER_BUILD_IMAGE: "index.docker.io/ksetcomp/brucifer-karte-2022"
_DOCKER_USERNAME:
from_secret: DOCKER_HUB_USERNAME
_DOCKER_PASSWORD:
from_secret: DOCKER_HUB_PASSWORD
commands:
- echo "Building '$_DOCKER_BUILD_IMAGE:${CI_COMMIT_SHA}' on '${CI_MACHINE}'"
- exit 1
- docker build --label 'org.kset.tag=kset-org-2023' -t "$_DOCKER_BUILD_IMAGE":latest -t "$_DOCKER_BUILD_IMAGE":"${CI_COMMIT_SHA}" .
- echo "Logging into docker registry"
- docker login -u "$_DOCKER_USERNAME" -p "$_DOCKER_PASSWORD"
- echo "Pushing '$_DOCKER_BUILD_IMAGE:${CI_COMMIT_SHA}'"
- docker push --all-tags "$_DOCKER_BUILD_IMAGE"
- docker image rm "$_DOCKER_BUILD_IMAGE:${CI_COMMIT_SHA}"
volumes:
- /var/run/docker.sock:/var/run/docker.sock

- name: notify-watchtower
# failure: ignore
image: curlimages/curl
environment:
_WATCHTOWER_URL:
from_secret: WATCHTOWER_URL
_WATCHTOWER_TOKEN:
from_secret: WATCHTOWER_TOKEN
commands:
- 'curl -sL -H "Authorization: Bearer $_WATCHTOWER_TOKEN" "$_WATCHTOWER_URL/v1/update"'
4 changes: 1 addition & 3 deletions docker-compose.yml → compose.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.3'

services:
django:
build:
Expand All @@ -13,4 +11,4 @@ services:
context: ./ui
dockerfile: Dockerfile
depends_on:
- django
- django

0 comments on commit 48d470e

Please sign in to comment.