2022-09-02 18:08:19 +02:00
|
|
|
FROM git.rustybever.be/chewing_bever/vlang:0.3.1 AS builder
|
2022-01-09 09:29:11 +01:00
|
|
|
|
2022-02-22 18:04:54 +01:00
|
|
|
ARG TARGETPLATFORM
|
|
|
|
ARG CI_COMMIT_SHA
|
|
|
|
ARG DI_VER=1.2.5
|
|
|
|
|
2022-01-13 13:51:02 +01:00
|
|
|
WORKDIR /app
|
2022-01-09 09:29:11 +01:00
|
|
|
|
2022-02-22 18:04:54 +01:00
|
|
|
# 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 ..
|
|
|
|
|
2022-01-13 13:51:02 +01:00
|
|
|
# Copy over source code & build production binary
|
|
|
|
COPY src ./src
|
|
|
|
COPY Makefile ./
|
2022-01-15 10:36:23 +01:00
|
|
|
|
2022-02-22 18:04:54 +01:00
|
|
|
RUN if [ -n "${CI_COMMIT_SHA}" ]; then \
|
|
|
|
curl --fail \
|
|
|
|
-o vieter \
|
|
|
|
"https://s3.rustybever.be/vieter/commits/${CI_COMMIT_SHA}/vieter-$(echo "${TARGETPLATFORM}" | sed 's:/:-:g')" && \
|
|
|
|
chmod +x vieter ; \
|
|
|
|
else \
|
2022-05-03 16:54:12 +02:00
|
|
|
LDFLAGS='-lz -lbz2 -llzma -lexpat -lzstd -llz4 -lsqlite3 -static' make prod && \
|
2022-02-22 18:04:54 +01:00
|
|
|
mv pvieter vieter ; \
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
FROM busybox:1.35.0
|
|
|
|
|
|
|
|
ENV PATH=/bin \
|
2022-05-03 16:54:12 +02:00
|
|
|
VIETER_DATA_DIR=/data \
|
|
|
|
VIETER_PKG_DIR=/data/pkgs
|
2022-02-22 18:04:54 +01:00
|
|
|
|
|
|
|
COPY --from=builder /app/dumb-init /app/vieter /bin/
|
2022-01-09 09:29:11 +01:00
|
|
|
|
2022-02-22 18:04:54 +01:00
|
|
|
RUN mkdir /data && \
|
2022-05-16 17:17:42 +02:00
|
|
|
chown -R www-data:www-data /data
|
2022-01-09 09:29:11 +01:00
|
|
|
|
2022-02-22 18:04:54 +01:00
|
|
|
WORKDIR /data
|
2022-01-09 09:29:11 +01:00
|
|
|
|
2022-02-22 18:04:54 +01:00
|
|
|
USER www-data:www-data
|
2022-01-09 09:29:11 +01:00
|
|
|
|
2022-02-22 18:04:54 +01:00
|
|
|
ENTRYPOINT ["/bin/dumb-init", "--"]
|
|
|
|
CMD ["/bin/vieter", "server"]
|