2023-03-28 14:01:05 +00:00
|
|
|
FROM rust:1-alpine as builder
|
|
|
|
|
|
|
|
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL sparse
|
2019-08-20 13:15:55 +00:00
|
|
|
|
2023-03-28 14:26:00 +00:00
|
|
|
WORKDIR /home/rust/src
|
|
|
|
|
2019-08-20 13:15:55 +00:00
|
|
|
COPY Cargo.toml /home/rust/src/
|
|
|
|
COPY Cargo.lock /home/rust/src/
|
2019-08-20 13:24:39 +00:00
|
|
|
RUN mkdir /home/rust/src/src && \
|
|
|
|
echo 'fn main() {}' > /home/rust/src/src/main.rs
|
2019-08-20 13:15:55 +00:00
|
|
|
|
|
|
|
RUN cargo fetch
|
2019-08-20 13:24:39 +00:00
|
|
|
RUN cargo build --release
|
2019-08-20 13:15:55 +00:00
|
|
|
|
|
|
|
RUN rm -f /home/rust/src/src/main.rs
|
|
|
|
COPY src /home/rust/src/src
|
2019-08-20 13:24:39 +00:00
|
|
|
RUN sudo chown -R rust:rust . && \
|
|
|
|
touch /home/rust/src/src/main.rs
|
2019-08-20 13:15:55 +00:00
|
|
|
|
|
|
|
RUN cargo build --release
|
|
|
|
|
|
|
|
FROM scratch
|
|
|
|
|
|
|
|
COPY static /static
|
|
|
|
COPY templates /templates
|
|
|
|
COPY --from=builder /home/rust/src/target/x86_64-unknown-linux-musl/release/qchgk_web /
|
|
|
|
|
|
|
|
VOLUME /db
|
|
|
|
|
|
|
|
EXPOSE 8088/tcp
|
|
|
|
|
|
|
|
ENTRYPOINT ["/qchgk_web"]
|