into-the-kosmos-generador/Dockerfile

39 lines
1.0 KiB
Docker
Raw Normal View History

2023-03-10 15:56:42 +01:00
################################################################################
## BUILDER
################################################################################
FROM rust:slim as builder
# para compilación estática sin libc
ENV TARGET x86_64-unknown-linux-musl
RUN rustup target add "$TARGET"
# xeneracion do executable
RUN USER=root mkdir ./itkg
WORKDIR ./itkg
ADD . ./
RUN cargo build --release --locked --target "$TARGET" \
&& mv "target/$TARGET/release/itkg" . \
&& strip itkg
# usuario para execucion
RUN groupadd app && useradd -g app app
################################################################################
## RUNER
################################################################################
FROM scratch
ARG APP=/app
EXPOSE 3007
COPY --from=builder /etc/passwd /etc/passwd
COPY --from=builder /etc/group /etc/group
COPY --from=builder --chown=app:app /itkg/itkg ${APP}/itkg
COPY --from=builder --chown=app:app /itkg/templates/ ${APP}/templates/
USER app
WORKDIR ${APP}
CMD ["./itkg"]