diff --git a/Dockerfile b/Dockerfile index e955d8b..274585a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,6 @@ +# we use thc for healthchecks +FROM codeberg.org/gigirassy/thc:latest AS thc + # alpine for static binaries FROM rust:alpine AS build @@ -19,6 +22,11 @@ USER 65535:65535 # copy binary into path COPY --from=build --chown=65535:65535 /tmp/bin/teletraan /teletraan +COPY --from=thc /thc /thc + +# configure thc +ENV THC_PORT=3000 \ + THC_PATH=/ # data workdir. this allows using teletraan as the base for images easily via simply ``COPY --from=build /app/dist .`` WORKDIR /data @@ -26,6 +34,7 @@ WORKDIR /data # expose EXPOSE 3000 -# to run it. the cmd is left free so people can serve single page apps with the -s flag +# to run it and thc. the cmd is left free so people can serve single page apps with the -s flag ENTRYPOINT ["/teletraan"] -CMD [""] \ No newline at end of file +CMD [""] +HEALTHCHECK --interval=5s --timeout=5s --start-period=10s --retries=5 CMD ["/thc"] \ No newline at end of file