]> Repositorios git - scryer-prolog.git/commitdiff
Revert "Revert "Created and Tested Dockerfile""
authorpanasenco <[email protected]>
Fri, 22 May 2020 20:35:14 +0000 (13:35 -0700)
committerpanasenco <[email protected]>
Fri, 22 May 2020 20:57:48 +0000 (13:57 -0700)
This reverts commit e00d864199549c179a4403fba910b234646cdba5.

.dockerignore [new file with mode: 0755]
Dockerfile [new file with mode: 0755]
README.md

diff --git a/.dockerignore b/.dockerignore
new file mode 100755 (executable)
index 0000000..050103c
--- /dev/null
@@ -0,0 +1,6 @@
+target\r
+Dockerfile\r
+README.md\r
+.git\r
+.gitignore\r
+.gitmodules\r
diff --git a/Dockerfile b/Dockerfile
new file mode 100755 (executable)
index 0000000..3b2c3a0
--- /dev/null
@@ -0,0 +1,30 @@
+# Based on https://hub.docker.com/_/rust?tab=description and https://hub.docker.com/_/rust?tab=description\r
+\r
+# The first container is for build purposes only.\r
+FROM rust as builder\r
+\r
+WORKDIR /usr/src/scryer-prolog\r
+\r
+# Using a dummy build.rs and src/main.rs with your Cargo.toml lets Docker cache your Rust dependencies and not rebuild\r
+# them every time.\r
+COPY Cargo.toml .\r
+COPY Cargo.lock .\r
+RUN mkdir -p src\r
+RUN echo "fn main() {}" > src/main.rs\r
+RUN echo "fn main() {}" > build.rs\r
+RUN cargo build --release\r
+\r
+# We need to touch our real main.rs and build.rs files or else\r
+# docker will use the cached ones.\r
+COPY . .\r
+RUN touch src/main.rs\r
+RUN touch build.rs\r
+\r
+RUN cargo build --release\r
+\r
+RUN ls ./target/release\r
+\r
+# Finally, copy the scryer-prolog executable to a slimmer container.\r
+FROM debian:buster-slim\r
+COPY --from=builder /usr/src/scryer-prolog/target/release/scryer-prolog /usr/local/bin/scryer-prolog\r
+CMD ["scryer-prolog"]\r
index 2a477a283a5bd4649a741a2ba48e64bc211b66ac..623f7e6e71c39190d393f0c6b6128de9a55c0e75 100644 (file)
--- a/README.md
+++ b/README.md
@@ -93,6 +93,8 @@ strings.
 
 ## Installing Scryer Prolog
 
+### Native Install (Unix Only)
+
 First, install the latest stable version of
 [Rust](https://www.rust-lang.org/en-US/install.html) using your
 preferred method. Scryer tends to use features from newer Rust
@@ -126,6 +128,26 @@ $> cargo run [--release]
 The optional `--release` flag will perform various optimizations,
 producing a faster executable.
 
+### Docker Install (All Platforms)
+
+To automatically download, install, and run Scryer Prolog via Docker,
+simply run:
+```
+$> docker run -it mthom/scryer-prolog
+```
+
+To be able to load your program files, bind mount your programs folder
+as a Docker volume:
+
+```
+$> docker run -v /home/user/prolog:/mnt -it mthom/scryer-prolog
+?- consult('mnt/program.pl').
+true.
+```
+
+[Docker](https://hub.docker.com/editions/community/docker-ce-desktop-windows)
+is currently the only way to run scryer-prolog on Windows.
+
 ## Tutorial
 
 Prolog files are loaded by specifying them as arguments on the command