Make final docker image smaller

This commit is contained in:
Ethan O'Brien 2024-07-05 10:39:30 -05:00
parent fbda01a5fe
commit de0b75794d

View file

@ -1,4 +1,6 @@
FROM docker.io/library/debian:latest FROM docker.io/library/debian:latest as builder
# First - build
RUN apt update && apt install -y curl npm libssl-dev perl git RUN apt update && apt install -y curl npm libssl-dev perl git
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash
@ -13,14 +15,15 @@ RUN npm i && npm run build
WORKDIR /ew/ WORKDIR /ew/
RUN . "$HOME/.cargo/env" && cargo build --release RUN . "$HOME/.cargo/env" && cargo build --release
RUN mkdir /root/ew/ && cp target/release/ew /root/ew/ew
## Second - sort stuff idk
FROM docker.io/library/debian:bookworm-slim
RUN mkdir -p /root/ew/
COPY --from=builder /ew/target/release/ew /root/ew/ew
COPY ./start.sh /root/ew/start.sh COPY ./start.sh /root/ew/start.sh
RUN chmod +x /root/ew/start.sh RUN chmod +x /root/ew/start.sh
WORKDIR /
RUN rm -rf /ew/
ENTRYPOINT ["/root/ew/start.sh"] ENTRYPOINT ["/root/ew/start.sh"]