-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (59 loc) · 2.31 KB
/
Copy pathdocker.yml
File metadata and controls
67 lines (59 loc) · 2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Builds the image and actually starts it, because a Dockerfile that compiles is
# not the same as one that serves the app. Exists mainly so the Docker path in
# the README is verified by something other than trust: it is the first thing a
# self-hoster runs, and it breaks silently when the build output moves.
name: Docker
on:
push:
branches: [main]
paths:
- "Dockerfile"
- "docker-compose.yml"
- "docker/**"
- ".dockerignore"
- "package*.json"
- "src/**"
- "index.html"
- "vite.config.ts"
- ".github/workflows/docker.yml"
pull_request:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build the image
# Placeholder values on purpose. Vite only needs them to exist at build
# time, and nothing in this job talks to a real Supabase project.
run: |
docker build \
--build-arg VITE_SUPABASE_URL=https://ci.example.supabase.co \
--build-arg VITE_SUPABASE_ANON_KEY=ci-placeholder-anon-key \
--build-arg VITE_OWNER_EMAIL=ci@example.com \
-t task-organizer:ci .
- name: Refuse to build without the three values
# The guard in the Dockerfile is the difference between a clear failure
# here and a white page in someone's browser an hour from now.
run: |
if docker build -t task-organizer:missing-args . 2>/dev/null; then
echo "The image built with no build args. The guard in the Dockerfile is dead."
exit 1
fi
echo "Refused, as it should."
- name: Start the container
run: docker run -d --name task-organizer -p 8080:80 task-organizer:ci
- name: Serve the app
run: |
for _ in $(seq 1 30); do
curl -fsS http://localhost:8080 -o /tmp/index.html && break
sleep 1
done
grep -q 'id="root"' /tmp/index.html
- name: Fall back to index.html on a path that is not a file
# try_files in docker/nginx.conf. Without it a reload on a deep link
# returns nginx's own 404 instead of the app.
run: curl -fsS http://localhost:8080/not/a/real/file | grep -q 'id="root"'
- name: Container logs
if: failure()
run: docker logs task-organizer