mirror of
https://github.com/neocturne/MinedMap.git
synced 2025-03-04 17:23:33 +01:00
Merge pull request #67 from neocturne/docker
Docker image improvements and docker-compose.yml example
This commit is contained in:
commit
0a08e8cc46
5 changed files with 83 additions and 7 deletions
12
.github/workflows/MinedMap.yml
vendored
12
.github/workflows/MinedMap.yml
vendored
|
@ -154,6 +154,16 @@ jobs:
|
||||||
needs:
|
needs:
|
||||||
- test
|
- test
|
||||||
steps:
|
steps:
|
||||||
|
- name: 'Checkout'
|
||||||
|
uses: 'actions/checkout@v4'
|
||||||
|
|
||||||
|
- name: 'Get version'
|
||||||
|
id: 'tag'
|
||||||
|
run: |
|
||||||
|
set -o pipefail
|
||||||
|
git fetch --prune --unshallow --tags -f
|
||||||
|
echo "tag=$(git describe --abbrev=7 --match='v*' | sed 's/^v//')" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Docker meta
|
- name: Docker meta
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
|
@ -182,6 +192,8 @@ jobs:
|
||||||
- name: Build
|
- name: Build
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
|
build-args: |
|
||||||
|
MINEDMAP_VERSION=${{ steps.tag.outputs.tag }}
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
FROM docker.io/library/alpine:latest AS builder
|
FROM docker.io/library/alpine:latest AS builder
|
||||||
|
|
||||||
|
ARG MINEDMAP_VERSION
|
||||||
|
|
||||||
WORKDIR /build
|
WORKDIR /build
|
||||||
RUN apk add --no-cache build-base cmake cargo
|
RUN apk add --no-cache build-base cmake cargo
|
||||||
|
|
||||||
|
@ -9,7 +11,12 @@ RUN strip target/release/minedmap
|
||||||
|
|
||||||
FROM docker.io/library/alpine:latest
|
FROM docker.io/library/alpine:latest
|
||||||
|
|
||||||
|
RUN addgroup -g 1000 -S minedmap \
|
||||||
|
&& adduser -S -D -H -u 1000 -h /output -s /sbin/nologin -G minedmap -g minedmap minedmap
|
||||||
|
|
||||||
RUN apk add --no-cache libgcc tini
|
RUN apk add --no-cache libgcc tini
|
||||||
|
|
||||||
COPY --from=builder /build/target/release/minedmap /bin/minedmap
|
COPY --from=builder /build/target/release/minedmap /bin/minedmap
|
||||||
ENTRYPOINT [ "/sbin/tini", "--", "/bin/minedmap" ]
|
ENTRYPOINT [ "/sbin/tini", "--", "/bin/minedmap" ]
|
||||||
|
|
||||||
|
USER minedmap:minedmap
|
||||||
|
|
51
docker-compose.yml
Normal file
51
docker-compose.yml
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
# This is an example docker-compose configuration providing a Minecraft server,
|
||||||
|
# map generator and webserver. Visit http://localhost:8080 to view the map.
|
||||||
|
#
|
||||||
|
# See https://docker-minecraft-server.readthedocs.io/ for more information on
|
||||||
|
# the itzg/minecraft-server image and its configuration.
|
||||||
|
|
||||||
|
services:
|
||||||
|
mc:
|
||||||
|
image: docker.io/itzg/minecraft-server
|
||||||
|
environment:
|
||||||
|
EULA: 'true'
|
||||||
|
ports:
|
||||||
|
- '25565:25565'
|
||||||
|
volumes:
|
||||||
|
- data:/data
|
||||||
|
stdin_open: true
|
||||||
|
tty: true
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
minedmap:
|
||||||
|
image: ghcr.io/neocturne/minedmap/minedmap
|
||||||
|
command:
|
||||||
|
- '--jobs-initial=2'
|
||||||
|
- '--image-format=webp'
|
||||||
|
- '--sign-filter=\[Map\]'
|
||||||
|
- '--sign-transform=s/\[Map\]//'
|
||||||
|
- '--watch'
|
||||||
|
- '/input/world'
|
||||||
|
- '/output'
|
||||||
|
volumes:
|
||||||
|
- data:/input
|
||||||
|
- output:/output
|
||||||
|
- processed:/output/processed
|
||||||
|
network_mode: 'none'
|
||||||
|
depends_on:
|
||||||
|
mc:
|
||||||
|
condition: service_healthy
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
viewer:
|
||||||
|
image: ghcr.io/neocturne/minedmap/viewer
|
||||||
|
ports:
|
||||||
|
- '8080:80'
|
||||||
|
volumes:
|
||||||
|
- output:/usr/share/nginx/html/data
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
data: {}
|
||||||
|
processed: {}
|
||||||
|
output: {}
|
|
@ -33,17 +33,23 @@ use tracing::{info, warn};
|
||||||
|
|
||||||
use self::entity_collector::EntityCollector;
|
use self::entity_collector::EntityCollector;
|
||||||
|
|
||||||
/// MinedMap version number
|
/// Returns the MinedMap version number
|
||||||
const VERSION: &str = git_version!(
|
fn version() -> &'static str {
|
||||||
|
option_env!("MINEDMAP_VERSION").unwrap_or(
|
||||||
|
git_version!(
|
||||||
args = ["--abbrev=7", "--match=v*", "--dirty=-modified"],
|
args = ["--abbrev=7", "--match=v*", "--dirty=-modified"],
|
||||||
cargo_prefix = "v",
|
cargo_prefix = "v",
|
||||||
);
|
)
|
||||||
|
.strip_prefix("v")
|
||||||
|
.unwrap(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
/// Command line arguments for minedmap CLI
|
/// Command line arguments for minedmap CLI
|
||||||
#[derive(Debug, Parser)]
|
#[derive(Debug, Parser)]
|
||||||
#[command(
|
#[command(
|
||||||
about,
|
about,
|
||||||
version = VERSION.strip_prefix("v").unwrap(),
|
version = version(),
|
||||||
max_term_width = 100,
|
max_term_width = 100,
|
||||||
)]
|
)]
|
||||||
pub struct Args {
|
pub struct Args {
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
FROM docker.io/library/nginx:alpine
|
FROM docker.io/library/nginx:alpine-slim
|
||||||
COPY . /usr/share/nginx/html
|
COPY . /usr/share/nginx/html
|
||||||
# datadir should be mounted to: /usr/share/nginx/html/data
|
# datadir should be mounted to: /usr/share/nginx/html/data
|
||||||
|
|
Loading…
Add table
Reference in a new issue