32 lines
646 B
Docker
32 lines
646 B
Docker
FROM rustlang/rust:nightly-alpine as builder
|
|
|
|
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL sparse
|
|
|
|
RUN apk add --no-cache musl-dev
|
|
|
|
WORKDIR /home/rust/src
|
|
|
|
COPY Cargo.toml /home/rust/src/
|
|
COPY Cargo.lock /home/rust/src/
|
|
RUN mkdir /home/rust/src/src && \
|
|
echo 'fn main() {}' > /home/rust/src/src/main.rs
|
|
|
|
RUN cargo fetch
|
|
RUN cargo build --release
|
|
|
|
RUN rm -f /home/rust/src/src/main.rs
|
|
COPY src /home/rust/src/src
|
|
RUN touch /home/rust/src/src/main.rs
|
|
|
|
RUN cargo build -v --release
|
|
|
|
FROM scratch
|
|
|
|
COPY static /static
|
|
COPY templates /templates
|
|
COPY --from=builder /home/rust/src/target/release/qchgk_web /
|
|
|
|
EXPOSE 8088/tcp
|
|
|
|
ENTRYPOINT ["/qchgk_web"]
|