qchgk_web_docker/Dockerfile

32 lines
646 B
Docker
Raw Normal View History

2023-03-28 16:12:23 +00:00
FROM rustlang/rust:nightly-alpine as builder
2023-03-28 14:01:05 +00:00
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL sparse
2019-08-20 13:15:55 +00:00
2023-03-28 14:28:39 +00:00
RUN apk add --no-cache musl-dev
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
2023-03-28 16:19:27 +00:00
RUN touch /home/rust/src/src/main.rs
2019-08-20 13:15:55 +00:00
2023-03-28 16:19:27 +00:00
RUN cargo build -v --release
2019-08-20 13:15:55 +00:00
FROM scratch
COPY static /static
COPY templates /templates
2023-03-28 16:29:18 +00:00
COPY --from=builder /home/rust/src/target/release/qchgk_web /
2019-08-20 13:15:55 +00:00
EXPOSE 8088/tcp
ENTRYPOINT ["/qchgk_web"]