Merge branch 'master' of github.com:minetest-mapserver/mapserver

This commit is contained in:
BuckarooBanzay 2024-06-28 17:29:41 +02:00
commit 3be317d09f
5 changed files with 60 additions and 39 deletions

View File

@ -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
@ -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
.github/workflows/docker.yml vendored Normal file
View File

@ -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 }}

View File

@ -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

View File

@ -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"

View File

@ -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
@ -29,7 +27,7 @@ Examplary `docker-compose` config:
```yml
services:
mapserver:
image: minetesttools/mapserver
image: ghcr.io/minetest-mapserver/mapserver
restart: always
networks:
- default