Merge pull request #517 from panasenco/docker
Created and Tested Dockerfile
This commit is contained in:
6
.dockerignore
Executable file
6
.dockerignore
Executable file
@@ -0,0 +1,6 @@
|
|||||||
|
target
|
||||||
|
Dockerfile
|
||||||
|
README.md
|
||||||
|
.git
|
||||||
|
.gitignore
|
||||||
|
.gitmodules
|
||||||
30
Dockerfile
Executable file
30
Dockerfile
Executable 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"]
|
||||||
22
README.md
22
README.md
@@ -93,6 +93,8 @@ strings.
|
|||||||
|
|
||||||
## Installing Scryer Prolog
|
## Installing Scryer Prolog
|
||||||
|
|
||||||
|
### Native Install (Unix Only)
|
||||||
|
|
||||||
First, install the latest stable version of
|
First, install the latest stable version of
|
||||||
[Rust](https://www.rust-lang.org/en-US/install.html) using your
|
[Rust](https://www.rust-lang.org/en-US/install.html) using your
|
||||||
preferred method. Scryer tends to use features from newer Rust
|
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,
|
The optional `--release` flag will perform various optimizations,
|
||||||
producing a faster executable.
|
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
|
## Tutorial
|
||||||
|
|
||||||
Prolog files are loaded by specifying them as arguments on the command
|
Prolog files are loaded by specifying them as arguments on the command
|
||||||
|
|||||||
Reference in New Issue
Block a user