Skip to content

Commit

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

on:
push:

concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
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: Add some env variables (REMOVE WHEN FIXED)
run: |
echo "VUE_APP_DJANGO_USER=comp" >> ./ui/.env
echo "VUE_APP_DJANGO_PASS=Qf1EAPLhMv5c4CC8cbB0FUkB35rHSRcZ" >> ./ui/.env
echo "VUE_APP_BASE_URL=/api" >> ./ui/.env
- 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-frontend:latest
ksetcomp/brucifer-karte-2022-frontend:${{ github.sha }}
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 and push
uses: docker/build-push-action@v6
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
pull: true
tags: |
ksetcomp/brucifer-karte-2022-backend:latest
ksetcomp/brucifer-karte-2022-backend:${{ github.sha }}
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"
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ RUN pip install -r requirements.txt
ADD . /code/
COPY ./docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod a+x /docker-entrypoint.sh
ENTRYPOINT ["bash","/docker-entrypoint.sh"]
EXPOSE 8000
ENTRYPOINT ["bash","/docker-entrypoint.sh"]
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 9b8ee6e

Please sign in to comment.