Files
paste/Dockerfile
Gunwant Jain edc247b558 Templates: fix the content type of templates
Templating is weird af in Rocket. Look into 3a541ae for more.
The content-type of the rendering is determined by the extension of the
template name.

But renaming these templates would break building the project for
development because it finds a phony template there. So the trick is to
default the `template_dir` to `args.upload` because it should never
interfere and will be always present.
This also fixes the hax in Dockerfile by making it the default.

Signed-off-by: Gunwant Jain <mail@wantguns.dev>
2022-01-19 16:33:57 +05:30

31 lines
711 B
Docker

###### Builder Image
FROM rust as builder
WORKDIR /app
COPY . .
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 .;
RUN cargo clean
###### Runner Image
FROM scratch as runner
COPY --from=builder /usr/local/cargo/bin/bin .
ENV BIN_ADDRESS=0.0.0.0
EXPOSE 6162
CMD ["./bin"]