qchgk_web_docker/alpine.Dockerfile

40 lines
1.1 KiB
Docker
Raw Normal View History

2019-08-20 13:15:55 +00:00
FROM ekidd/rust-musl-builder:1.36.0 as builder
COPY Cargo.toml /home/rust/src/
COPY Cargo.lock /home/rust/src/
RUN mkdir /home/rust/src/src && touch /home/rust/src/src/main.rs
RUN sudo chown -R rust:rust .
RUN cargo fetch
RUN cargo build --release || true
RUN rm -f /home/rust/src/src/main.rs
COPY src /home/rust/src/src
#COPY pre-main.rs /home/rust/src
#COPY add-Cargo.toml /home/rust/src\
#RUN mv /home/rust/src/src/main.rs /home/rust/src/tmp-main.rs &&\
# cat /home/rust/src/pre-main.rs > /home/rust/src/src/main.rs &&\
# cat /home/rust/src/tmp-main.rs >> /home/rust/src/src/main.rs &&\
# echo >> /home/rust/src/Cargo.toml &&\
# cat /home/rust/src/add-Cargo.toml >> /home/rust/src/Cargo.toml
#RUN sudo apt-get update && sudo apt-get install -y autogen automake git make
RUN cargo build --release
FROM alpine:3.10
RUN mkdir /app
COPY static /app/static
COPY templates /app/templates
COPY --from=builder /home/rust/src/target/x86_64-unknown-linux-musl/release/qchgk_web /app/qchgk_web
RUN ls -lsha /app/qchgk_web
WORKDIR /app
EXPOSE 8088/tcp
CMD /app/qchgk_web