Skip to content

Commit 124cc5c

Browse files
committed
fix(docker): missing curl installation for health check
Closes #725. Signed-off-by: Gil Desmarais <[email protected]>
1 parent b918342 commit 124cc5c

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,15 @@ ENV PORT=3000 \
3535

3636
EXPOSE $PORT
3737

38-
HEALTHCHECK --interval=30m --timeout=60s --start-period=5s \
39-
CMD curl -f http://${HEALTH_CHECK_USERNAME}:${HEALTH_CHECK_PASSWORD}@localhost:${PORT}/health_check.txt || exit 1
38+
HEALTHCHECK --interval=60s --timeout=15s --start-period=5s \
39+
CMD curl -f http://localhost:${PORT}/health_check.txt || exit 1
4040

4141
ARG USER=html2rss
4242
ARG UID=991
4343
ARG GID=991
4444

4545
RUN apk add --no-cache \
46+
'curl>=8' \
4647
'gcompat>=0' \
4748
'tzdata>=2024' \
4849
'libxml2>=2' \

Rakefile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,22 @@ task :test do
6262

6363
Output.describe 'Print output of `html2rss help`'
6464
sh 'docker exec html2rss-web-test html2rss help'
65+
66+
Output.describe 'Expect health status to be healthy'
67+
health_status = nil
68+
10.times do
69+
health_status = `docker inspect --format='{{.State.Health.Status}}' html2rss-web-test`.strip
70+
71+
if health_status == 'healthy'
72+
puts '✅ Health status reports `healthy`'
73+
break
74+
else
75+
putc '.'
76+
sleep 3
77+
end
78+
end
79+
80+
raise "❌ Health status reports `#{health_status}`" if health_status != 'healthy'
6581
ensure
6682
test_container_exists = JSON.parse(`docker inspect html2rss-web-test`).any?
6783

@@ -72,4 +88,6 @@ ensure
7288
sh 'docker stop html2rss-web-test'
7389
sh 'docker rm html2rss-web-test'
7490
end
91+
92+
exit 1 if $ERROR_INFO
7593
end

0 commit comments

Comments
 (0)