2022-01-17 22:33:04 -06:00
|
|
|
###### Builder Image
|
|
|
|
FROM rust as builder
|
2021-07-12 17:58:48 -05:00
|
|
|
WORKDIR /app
|
2020-12-29 16:50:39 -06:00
|
|
|
COPY . .
|
2022-01-17 22:33:04 -06:00
|
|
|
# scratch does not have the mkdir binary, so we create a folder here
|
|
|
|
RUN mkdir -p empty_upload
|
|
|
|
|
|
|
|
ARG ARCH
|
|
|
|
RUN __ARCH="$(dpkg --print-architecture)"; \
|
|
|
|
[ -z $ARCH ] || __ARCH=$ARCH; \
|
|
|
|
case "$__ARCH" in \
|
|
|
|
arm64) \
|
|
|
|
export __TARGET='aarch64-unknown-linux-gnu'; \
|
|
|
|
apt update && apt upgrade -y; \
|
|
|
|
apt install -y gcc-aarch64-linux-gnu; \
|
|
|
|
rustup target add aarch64-unknown-linux-gnu; \
|
|
|
|
;; \
|
|
|
|
amd64) export __TARGET='x86_64-unknown-linux-gnu' ;; \
|
|
|
|
esac; \
|
|
|
|
cargo install --target $__TARGET --path .;
|
|
|
|
|
2021-07-12 17:58:48 -05:00
|
|
|
RUN cargo clean
|
2020-12-29 16:50:39 -06:00
|
|
|
|
2022-01-17 22:33:04 -06:00
|
|
|
|
|
|
|
###### Runner Image
|
|
|
|
FROM scratch as runner
|
|
|
|
COPY --from=builder /app/empty_upload upload
|
2021-07-13 10:50:54 -05:00
|
|
|
COPY ./client upload/client
|
2020-12-29 16:50:39 -06:00
|
|
|
COPY ./templates templates
|
2021-07-12 17:58:48 -05:00
|
|
|
COPY ./static static
|
2022-01-16 10:34:05 -06:00
|
|
|
COPY ./themes themes
|
|
|
|
COPY --from=builder /usr/local/cargo/bin/bin .
|
2021-07-12 17:58:48 -05:00
|
|
|
|
2020-12-29 16:50:39 -06:00
|
|
|
ENV ROCKET_ADDRESS=0.0.0.0
|
|
|
|
ENV ROCKET_PORT=6162
|
|
|
|
|
2021-07-12 17:58:48 -05:00
|
|
|
EXPOSE 6162
|
2022-01-16 10:34:05 -06:00
|
|
|
CMD ["./bin"]
|