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:
|
||||
push:
|
||||
@@ -6,25 +7,17 @@ on:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
deploy:
|
||||
runs-on: self-hosted
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
- name: Build and deploy with Docker Compose
|
||||
run: |
|
||||
# Próba zatrzymania i usunięcia starego kontenera (ignoruje błąd jeśli nie istnieje)
|
||||
docker compose down --remove-orphans || true
|
||||
docker rm -f rubic-cube || true
|
||||
|
||||
- name: Login to Gitea Registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: gitea.7u.pl
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
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
|
||||
# Start nowej wersji
|
||||
docker compose up -d --build
|
||||
|
||||
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).
|
||||
|
||||
## 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
|
||||
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.
|
||||
Aplikacja dostępna jest na porcie **8083**.
|
||||
|
||||
@@ -10,16 +10,6 @@ services:
|
||||
networks:
|
||||
- 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:
|
||||
rubic-net:
|
||||
driver: bridge
|
||||
|
||||
Reference in New Issue
Block a user