Skip to content

Commit ec4bc16

Browse files
ci: dynamic default branch name
1 parent f31d488 commit ec4bc16

File tree

2 files changed

+35
-16
lines changed

2 files changed

+35
-16
lines changed

.github/workflows/docker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ jobs:
9797
type=semver,pattern={{major}}.{{minor}}
9898
type=semver,pattern={{major}}
9999
type=sha
100-
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/main') }}
100+
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch || 'main') }}
101101
102102
- name: Setup QEMU
103103
uses: docker/setup-qemu-action@v3

process-compose.yml

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,45 @@ is_strict: true
1414
disable_env_expansion: true
1515

1616
processes:
17-
redis:
17+
flask:
18+
command: flask --app main run
19+
working_dir: ./app
20+
environment:
21+
- FLASK_APP=main
22+
- FLASK_DEBUG=True
23+
depends_on:
24+
db:
25+
condition: "process_started"
26+
availability:
27+
restart: "always"
28+
backoff_seconds: 5 # default: 1
29+
max_restarts: 0 # default: 0 (unlimited)
30+
31+
db:
1832
command: >
1933
docker run --rm -d \
20-
--name "${NAME:-devbox-redis}" \
21-
-p "${PORT:-6379}:6379" \
22-
"redis:${VERSION:-6.2}-alpine"
34+
--name ${CONTAINER_NAME} \
35+
-e POSTGRES_INITDB_ARGS="--locale-provider=icu --icu-locale=en_US.UTF-8" \
36+
-e POSTGRES_DB=${POSTGRES_DB} \
37+
-e POSTGRES_USER=${POSTGRES_USER} \
38+
-e POSTGRES_PASSWORD=${POSTGRES_PASSWORD} \
39+
-p ${PORT}:5432 \
40+
postgres:${VERSION}-alpine3.20
2341
is_daemon: true
24-
environment: null
42+
is_tty: false
43+
environment:
44+
- CONTAINER_NAME=${CONTAINER_NAME:-devbox-postgres}
45+
- VERSION=${VERSION:-16.3}
46+
- PORT=${PORT:-5432}
47+
- POSTGRES_DB=${DB_NAME:-postgres}
48+
- POSTGRES_USER=${DB_USER:-postgres}
49+
- POSTGRES_PASSWORD=${DB_PASS?}
2550
readiness_probe:
2651
exec:
2752
command: >
28-
timeout 12s bash -c \
29-
"until echo PING \
30-
| nc -z localhost ${PORT:-6379} \
31-
; do sleep 1 \
53+
timeout 30s bash -c \
54+
"until docker exec ${CONTAINER_NAME} pg_isready \
55+
; do sleep 3 \
3256
; done"
33-
availability:
34-
exit_on_end: true
35-
is_tty: false
3657
shutdown:
37-
command: "docker stop ${NAME:-devbox-redis}"
38-
timeout_seconds: 10 # default: 10
39-
signal: 15 # default: 15
58+
command: "docker stop ${CONTAINER_NAME}"

0 commit comments

Comments
 (0)