one Dockerfile

This commit is contained in:
Dmitry Belyaev 2019-08-20 16:24:39 +03:00
parent 538ba9f2d9
commit 025c58adac
Signed by: b4tman
GPG Key ID: 41A00BF15EA7E5F3
5 changed files with 7 additions and 104 deletions

View File

@ -1,16 +1,19 @@
FROM ekidd/rust-musl-builder:1.36.0 as builder
FROM ekidd/rust-musl-builder:nightly-2019-07-08 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 mkdir /home/rust/src/src && \
echo 'fn main() {}' > /home/rust/src/src/main.rs
RUN sudo chown -R rust:rust .
RUN cargo fetch
RUN cargo build --release || true
RUN cargo build --release
RUN rm -f /home/rust/src/src/main.rs
COPY src /home/rust/src/src
RUN sudo chown -R rust:rust . && \
touch /home/rust/src/src/main.rs
RUN cargo build --release

View File

@ -1,39 +0,0 @@
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

View File

@ -3,7 +3,7 @@ services:
qchgk:
build:
context: src
dockerfile: ../nightly.Dockerfile
dockerfile: ../Dockerfile
image: 'b4tman/qchgk:rocket'
container_name: 'qchgk'
ports:
@ -20,4 +20,3 @@ services:
# RUST_BACKTRACE: full
volumes:
- '/data/lab/docker/qchgk_web/db:/db/:ro'

View File

@ -1,30 +0,0 @@
FROM ekidd/rust-musl-builder:nightly-2019-07-08 as builder
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 sudo chown -R rust:rust .
RUN cargo fetch
RUN cargo build --release
RUN rm -f /home/rust/src/src/main.rs
COPY src /home/rust/src/src
RUN sudo chown -R rust:rust . && \
touch /home/rust/src/src/main.rs
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"]

View File

@ -1,30 +0,0 @@
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 && \
echo 'fn main() {}' > /home/rust/src/src/main.rs
RUN sudo chown -R rust:rust /home/rust/src/
RUN cargo fetch
RUN cargo build --release
RUN rm -f /home/rust/src/src/main.rs
COPY src /home/rust/src/src
RUN sudo chown -R rust:rust /home/rust/src/ && \
touch /home/rust/src/src/main.rs
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"]