Skip to content

Commit 52bca59

Browse files
committed
Added FLATNOTES_PORT env var
1 parent 9f02353 commit 52bca59

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

.dockerignore

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
**
33

44
# Include the following
5+
!.htmlnanorc
56
!LICENSE
67
!Pipfile
78
!Pipfile.lock
8-
!package.json
9-
!package-lock.json
109
!client/**
11-
!server/**
1210
!entrypoint.sh
13-
!.htmlnanorc
11+
!healthcheck.sh
12+
!package-lock.json
13+
!package.json
14+
!server/**
1415
!vite.config.js

Dockerfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ ARG BUILD_DIR
2222
ENV PUID=1000
2323
ENV PGID=1000
2424
ENV EXEC_TOOL=gosu
25+
ENV FLATNOTES_PORT=8080
2526

2627
ENV APP_PATH=/app
2728
ENV FLATNOTES_PATH=/data
@@ -45,10 +46,11 @@ RUN pipenv install --deploy --ignore-pipfile --system && \
4546
COPY server ./server
4647
COPY --from=build ${BUILD_DIR}/client/dist ./client/dist
4748

49+
COPY entrypoint.sh healthcheck.sh /
50+
RUN chmod +x /entrypoint.sh /healthcheck.sh
51+
4852
VOLUME /data
49-
EXPOSE 8080/tcp
50-
HEALTHCHECK --interval=60s --timeout=10s CMD curl -f http://localhost:8080/health || exit 1
53+
EXPOSE ${FLATNOTES_PORT}/tcp
54+
HEALTHCHECK --interval=60s --timeout=10s CMD /healthcheck.sh
5155

52-
COPY entrypoint.sh /
53-
RUN chmod +x /entrypoint.sh
5456
ENTRYPOINT [ "/entrypoint.sh" ]

entrypoint.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ flatnotes_command="python -m \
2222
main:app \
2323
--app-dir server \
2424
--host 0.0.0.0 \
25-
--port 8080 \
25+
--port ${FLATNOTES_PORT} \
2626
--proxy-headers \
2727
--forwarded-allow-ips '*'"
2828

@@ -32,7 +32,7 @@ if [ `id -u` -eq 0 ] && [ `id -g` -eq 0 ]; then
3232

3333
echo Starting flatnotes as user ${PUID}...
3434
exec ${EXEC_TOOL} ${PUID}:${PGID} ${flatnotes_command}
35-
35+
3636
else
3737
echo "A user was set by docker, skipping file permission changes."
3838
echo Starting flatnotes as user $(id -u)...

healthcheck.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
3+
curl -f http://localhost:${FLATNOTES_PORT}/health || exit 1

0 commit comments

Comments
 (0)