mirror of
https://codeberg.org/gigirassy/teletraan.git
synced 2026-08-30 15:27:38 +00:00
Add Dockerfile.mimalloc
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
# we use thc for healthchecks
|
||||
FROM codeberg.org/gigirassy/thc:latest AS thc
|
||||
|
||||
# chimera is an musl distro with a patched libc for mimalloc, which incorporates it to entire package repo.
|
||||
FROM chimeralinux/chimera:latest AS build
|
||||
|
||||
# workdir, copy.
|
||||
WORKDIR /src
|
||||
COPY . .
|
||||
|
||||
# important step here.
|
||||
RUN apk add chimera-repo-user && apk add clang gcc lld libgcc-chimera curl libunwind llvm libatomic-chimera
|
||||
|
||||
RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly --component rust-src -y
|
||||
|
||||
RUN RUSTFLAGS="-Copt-level=z -Zfmt-debug=none -Zlocation-detail=none -Ctarget-feature=+crt-static" ~/.cargo/bin/cargo +nightly install --path=. --root /tmp -Z build-std=std -Z build-std-features="optimize_for_size"
|
||||
|
||||
# scratch runtime for security
|
||||
FROM scratch
|
||||
|
||||
# "nobody" user for security
|
||||
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
|
||||
|
||||
# expose
|
||||
EXPOSE 3000
|
||||
|
||||
# to run it and thc. the cmd is left free so people can serve single page apps with the -s flag
|
||||
ENTRYPOINT ["/teletraan"]
|
||||
CMD [""]
|
||||
HEALTHCHECK --interval=5s --timeout=5s --start-period=10s --retries=5 CMD ["/thc"]
|
||||
Reference in New Issue
Block a user