Skip to content

Commit

Permalink
Merge pull request #42 from Erb3-forked/docker
Browse files Browse the repository at this point in the history
feat: initial docker support
  • Loading branch information
Snowiiii authored Aug 24, 2024
2 parents fa1ca07 + a975515 commit ae028da
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# A whitelist of files that should be included into docker
# Put an exclaimation mark before everything to include

# Ignore everything
*

# Allow the source code folders
!/pumpkin*/

# Dependencies
!Cargo.lock
!Cargo.toml
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM rust:1-alpine3.19 AS builder
ENV RUSTFLAGS="-C target-feature=-crt-static -C target-cpu=native"
RUN apk add --no-cache musl-dev
WORKDIR /pumpkin
COPY . /pumpkin
RUN cargo build --release
RUN strip target/release/pumpkin

FROM alpine:3.19
WORKDIR /pumpkin
RUN apk add --no-cache libgcc
COPY --from=builder /pumpkin/target/release/pumpkin /pumpkin/pumpkin
ENTRYPOINT ["/pumpkin/pumpkin"]
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,21 @@ Then run:
RUSTFLAGS="-C target-cpu=native" cargo run --release
```

### Docker

Experimental Docker support is available.
The image is currently not published anywhere, but you can use the following command to build it:

```shell
docker build . -t pumpkin
```

To run it use the following command:

```shell
docker run --rm -v "./world:/pumpkin/world" pumpkin
```

## Contributions

Contributions are welcome! See [CONTRIBUTING.md](CONTRIBUTING.md)
Expand Down
1 change: 1 addition & 0 deletions pumpkin/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ fn main() -> io::Result<()> {
stdin
.read_line(&mut out)
.expect("Failed to read console line");

if !out.is_empty() {
handle_command(&mut commands::CommandSender::Console, &out);
}
Expand Down

0 comments on commit ae028da

Please sign in to comment.