Update CI/CD to use self-hosted runner and direct docker-compose build
Some checks failed
Deploy to Production / deploy (push) Failing after 2s
Some checks failed
Deploy to Production / deploy (push) Failing after 2s
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
name: Build and Publish Docker Image
|
name: Deploy to Production
|
||||||
|
run-name: Deploy to Production by @${{ github.actor }}
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -6,25 +7,17 @@ on:
|
|||||||
- main
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: self-hosted
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Check out repository code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Build and deploy with Docker Compose
|
||||||
uses: docker/setup-buildx-action@v2
|
run: |
|
||||||
|
# Próba zatrzymania i usunięcia starego kontenera (ignoruje błąd jeśli nie istnieje)
|
||||||
- name: Login to Gitea Registry
|
docker compose down --remove-orphans || true
|
||||||
uses: docker/login-action@v2
|
docker rm -f rubic-cube || true
|
||||||
with:
|
|
||||||
registry: gitea.7u.pl
|
# Start nowej wersji
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
docker compose up -d --build
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
||||||
|
|
||||||
- name: Build and push
|
|
||||||
uses: docker/build-push-action@v4
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
push: true
|
|
||||||
tags: gitea.7u.pl/gkucmierz/rubic-cube:latest
|
|
||||||
|
|||||||
15
README.md
15
README.md
@@ -4,13 +4,12 @@ This template should help get you started developing with Vue 3 in Vite. The tem
|
|||||||
|
|
||||||
Learn more about IDE Support for Vue in the [Vue Docs Scaling up Guide](https://vuejs.org/guide/scaling-up/tooling.html#ide-support).
|
Learn more about IDE Support for Vue in the [Vue Docs Scaling up Guide](https://vuejs.org/guide/scaling-up/tooling.html#ide-support).
|
||||||
|
|
||||||
## Uruchamianie (Docker Compose)
|
## Uruchamianie (Automatyczne - CI/CD)
|
||||||
|
|
||||||
Na serwerze, aby uruchomić aplikację w trybie produkcyjnym wraz z automatycznymi aktualizacjami (Watchtower):
|
Projekt wykorzystuje **Gitea Actions** z runnerem **self-hosted** na serwerze produkcyjnym.
|
||||||
|
Każdy push do gałęzi `main` automatycznie:
|
||||||
|
1. Pobiera kod na serwerze.
|
||||||
|
2. Zatrzymuje i usuwa stare kontenery.
|
||||||
|
3. Buduje i uruchamia nową wersję aplikacji przy użyciu `docker compose up -d --build`.
|
||||||
|
|
||||||
```bash
|
Aplikacja dostępna jest na porcie **8083**.
|
||||||
docker compose up -d
|
|
||||||
```
|
|
||||||
|
|
||||||
Aplikacja będzie dostępna na porcie **8083**.
|
|
||||||
Wszelkie zmiany w repozytorium (branch `main`) spowodują automatyczne zbudowanie nowego obrazu przez Gitea Actions i zaktualizowanie kontenera przez Watchtower.
|
|
||||||
|
|||||||
@@ -10,16 +10,6 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
- rubic-net
|
- rubic-net
|
||||||
|
|
||||||
watchtower:
|
|
||||||
image: containrrr/watchtower
|
|
||||||
container_name: watchtower
|
|
||||||
volumes:
|
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
|
||||||
command: --interval 60 --cleanup
|
|
||||||
restart: unless-stopped
|
|
||||||
networks:
|
|
||||||
- rubic-net
|
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
rubic-net:
|
rubic-net:
|
||||||
driver: bridge
|
driver: bridge
|
||||||
|
|||||||
Reference in New Issue
Block a user