Revert "Revert "Created and Tested Dockerfile""

This reverts commit e00d864199.
This commit is contained in:
panasenco
2020-05-22 13:35:14 -07:00
parent 0060c8988a
commit e82e36f51e
3 changed files with 58 additions and 0 deletions

30
Dockerfile Executable file
View File

@@ -0,0 +1,30 @@
# Based on https://hub.docker.com/_/rust?tab=description and https://hub.docker.com/_/rust?tab=description
# The first container is for build purposes only.
FROM rust as builder
WORKDIR /usr/src/scryer-prolog
# Using a dummy build.rs and src/main.rs with your Cargo.toml lets Docker cache your Rust dependencies and not rebuild
# them every time.
COPY Cargo.toml .
COPY Cargo.lock .
RUN mkdir -p src
RUN echo "fn main() {}" > src/main.rs
RUN echo "fn main() {}" > build.rs
RUN cargo build --release
# We need to touch our real main.rs and build.rs files or else
# docker will use the cached ones.
COPY . .
RUN touch src/main.rs
RUN touch build.rs
RUN cargo build --release
RUN ls ./target/release
# Finally, copy the scryer-prolog executable to a slimmer container.
FROM debian:buster-slim
COPY --from=builder /usr/src/scryer-prolog/target/release/scryer-prolog /usr/local/bin/scryer-prolog
CMD ["scryer-prolog"]