fix: performance #24
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 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache Docker layers | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-docker-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-docker- | |
- name: Create PostgreSQL data directory | |
run: | | |
sudo mkdir -p /root/mydata/postgresql-data | |
sudo chown -R 999:999 /root/mydata/postgresql-data | |
- name: Stop running Docker containers | |
run: sudo docker compose down || true | |
- name: Build and start Docker containers | |
run: sudo docker compose up -d --build --cache-from type=local,src=/tmp/.buildx-cache --cache-to type=local,dest=/tmp/.buildx-cache |