This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and run Docker container | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
jobs: | |
build: | |
runs-on: self-hosted | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Create PostgreSQL data directory | |
run: | | |
sudo mkdir -p /root/mydata/postgresql-data | |
sudo chown -R 999:999 /root/mydata/postgresql-data | |
- name: Stop all running Docker containers | |
run: sudo docker stop $(sudo docker ps -aq) || true | |
- name: Remove all Docker containers | |
run: sudo docker rm $(sudo docker ps -aq) || true | |
- name: Build and start Docker containers | |
run: sudo docker compose up -d --build |