Skip to content

Commit

Permalink
Merge branch 'master' of github.com:minetest-mapserver/mapserver
Browse files Browse the repository at this point in the history
  • Loading branch information
BuckarooBanzay committed Jun 28, 2024
2 parents d20d99d + fc73039 commit 3be317d
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 39 deletions.
16 changes: 0 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,6 @@ jobs:
run: |
go test ./...
# only on tags or the master branch
- name: Docker Login
if: success() && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master')
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

# only on tags
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
Expand All @@ -59,11 +51,3 @@ jobs:
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# only on the master branch
- name: Build and push latest docker image
if: success() && github.ref == 'refs/heads/master'
run: |
CGO_ENABLED=0 go build .
docker build . -t minetestmapserver/mapserver:latest
docker push minetestmapserver/mapserver:latest
39 changes: 39 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: docker

on:
push:
branches:
- 'main'
tags:
- 'v*'
pull_request:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/minetest-mapserver/mapserver

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
23 changes: 6 additions & 17 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
before:
hooks:
- go mod tidy
builds:
- env:
- CGO_ENABLED=0
targets:
- linux_amd64
- windows_amd64
- darwin_arm64
- linux_arm_6
goos:
- linux
- windows
goarch:
- amd64
- arm64
ldflags:
- -s -w -X mapserver/app.Version={{.Version}}
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
dockers:
- image_templates:
- "minetestmapserver/mapserver:{{ .Version }}"
- "minetestmapserver/mapserver:latest"
dockerfile: Dockerfile
15 changes: 13 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
FROM scratch
COPY mapserver /bin/mapserver
FROM node:20.15.0 as bundle-builder
COPY public /public
WORKDIR /public
RUN npm ci && npm run bundle

FROM golang:1.22.4 as go-builder
COPY . /data
COPY --from=bundle-builder /public/js/bundle* /data/public/js/
WORKDIR /data
RUN CGO_ENABLED=0 go build .

FROM alpine:3.20.1
COPY --from=go-builder /data/mapserver /bin/mapserver
ENV MT_CONFIG_PATH "mapserver.json"
ENV MT_LOGLEVEL "INFO"
ENV MT_READONLY "false"
Expand Down
6 changes: 2 additions & 4 deletions doc/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@ For additional infos (lag,time,players => active mode) on the mapserver interfac

## Docker image

* Docker-hub: https://hub.docker.com/repository/docker/minetestmapserver/mapserver

Simple docker run example to run in the world-directory:

```
docker run --rm --it -p 8080:8080 -v $(pwd):/minetest -w /minetest minetestmapserver/mapserver
docker run --rm --it -p 8080:8080 -v $(pwd):/minetest -w /minetest ghcr.io/minetest-mapserver/mapserver
```

## Docker compose
Expand All @@ -29,7 +27,7 @@ Examplary `docker-compose` config:
```yml
services:
mapserver:
image: minetesttools/mapserver
image: ghcr.io/minetest-mapserver/mapserver
restart: always
networks:
- default
Expand Down

0 comments on commit 3be317d

Please sign in to comment.