forked from vieter-v/vieter
Added healthcheck route; upgraded Docker image
parent
e26e2746de
commit
21c8e28e64
|
@ -4,17 +4,43 @@ FROM chewingbever/vlang:latest AS builder
|
||||||
|
|
||||||
ARG TARGETPLATFORM
|
ARG TARGETPLATFORM
|
||||||
ARG CI_COMMIT_SHA
|
ARG CI_COMMIT_SHA
|
||||||
|
ARG DI_VER=1.2.5
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Build dumb-init
|
||||||
|
RUN curl -Lo - "https://github.com/Yelp/dumb-init/archive/refs/tags/v${DI_VER}.tar.gz" | tar -xzf - && \
|
||||||
|
cd "dumb-init-${DI_VER}" && \
|
||||||
|
make SHELL=/bin/sh && \
|
||||||
|
mv dumb-init .. && \
|
||||||
|
cd ..
|
||||||
|
|
||||||
RUN curl --fail \
|
RUN curl --fail \
|
||||||
-o vieter \
|
-o vieter \
|
||||||
"https://s3.rustybever.be/vieter/commits/${CI_COMMIT_SHA}/vieter-$(echo "${TARGETPLATFORM}" | sed 's:/:-:g')" && \
|
"https://s3.rustybever.be/vieter/commits/${CI_COMMIT_SHA}/vieter-$(echo "${TARGETPLATFORM}" | sed 's:/:-:g')" && \
|
||||||
chmod +x vieter
|
chmod +x vieter
|
||||||
|
|
||||||
|
|
||||||
FROM scratch
|
FROM busybox:1.35.0
|
||||||
|
|
||||||
COPY --from=builder /app/vieter /bin/vieter
|
ENV PATH=/bin \
|
||||||
|
REPO_DIR=/data/repo \
|
||||||
|
PKG_DIR=/data/pkgs \
|
||||||
|
DOWNLOAD_DIR=/data/downloads
|
||||||
|
|
||||||
ENTRYPOINT ["/bin/vieter"]
|
COPY --from=builder /app/dumb-init /app/vieter /bin/
|
||||||
|
|
||||||
|
HEALTHCHECK --interval=30s \
|
||||||
|
--timeout=3s \
|
||||||
|
--start-period=5s \
|
||||||
|
CMD /bin/wget --spider http://localhost:8000/health || exit 1
|
||||||
|
|
||||||
|
RUN mkdir /data && \
|
||||||
|
chown -R www-data:www-data /data
|
||||||
|
|
||||||
|
WORKDIR /data
|
||||||
|
|
||||||
|
USER www-data:www-data
|
||||||
|
|
||||||
|
ENTRYPOINT ["/bin/dumb-init", "--"]
|
||||||
|
CMD ["/bin/vieter"]
|
||||||
|
|
|
@ -25,6 +25,11 @@ fn is_pkg_name(s string) bool {
|
||||||
return s.contains('.pkg')
|
return s.contains('.pkg')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
['/health'; get]
|
||||||
|
pub fn (mut app App) healthcheck() web.Result {
|
||||||
|
return app.text('Healthy')
|
||||||
|
}
|
||||||
|
|
||||||
// get_root handles a GET request for a file on the root
|
// get_root handles a GET request for a file on the root
|
||||||
['/:filename'; get]
|
['/:filename'; get]
|
||||||
fn (mut app App) get_root(filename string) web.Result {
|
fn (mut app App) get_root(filename string) web.Result {
|
||||||
|
|
Loading…
Reference in New Issue