forked from MTSR/mapserver
dev/cross cleanup
This commit is contained in:
parent
1d2800b59b
commit
cdb4f62609
26
.github/workflows/docker.yml
vendored
26
.github/workflows/docker.yml
vendored
@ -1,26 +0,0 @@
|
|||||||
name: docker
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches-ignore:
|
|
||||||
- 'renovate/*'
|
|
||||||
- 'dependabot/*'
|
|
||||||
tags:
|
|
||||||
- '*'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-20.04
|
|
||||||
timeout-minutes: 10
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@master
|
|
||||||
|
|
||||||
- name: docker publish
|
|
||||||
uses: elgohr/Publish-Docker-Github-Action@master
|
|
||||||
with:
|
|
||||||
name: minetestmapserver/mapserver
|
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
||||||
tag_names: true
|
|
||||||
cache: true
|
|
22
.github/workflows/release.yml
vendored
22
.github/workflows/release.yml
vendored
@ -1,22 +0,0 @@
|
|||||||
name: release
|
|
||||||
|
|
||||||
on:
|
|
||||||
release:
|
|
||||||
types: [created]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-20.04
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: build
|
|
||||||
run: make release
|
|
||||||
|
|
||||||
- name: upload
|
|
||||||
uses: skx/github-action-publish-binaries@master
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
args: 'output/mapserver-*'
|
|
@ -8,20 +8,18 @@ builds:
|
|||||||
- linux
|
- linux
|
||||||
- windows
|
- windows
|
||||||
- darwin
|
- darwin
|
||||||
archives:
|
goarch:
|
||||||
- replacements:
|
- amd64
|
||||||
darwin: Darwin
|
- arm64
|
||||||
linux: Linux
|
- arm
|
||||||
windows: Windows
|
ldflags:
|
||||||
386: i386
|
- -s -w -X mapserver/app.Version={{.Version}}
|
||||||
amd64: x86_64
|
|
||||||
checksum:
|
|
||||||
name_template: 'checksums.txt'
|
|
||||||
snapshot:
|
|
||||||
name_template: "{{ incpatch .Version }}-next"
|
|
||||||
changelog:
|
changelog:
|
||||||
sort: asc
|
sort: asc
|
||||||
filters:
|
filters:
|
||||||
exclude:
|
exclude:
|
||||||
- '^docs:'
|
- '^docs:'
|
||||||
- '^test:'
|
- '^test:'
|
||||||
|
dockers:
|
||||||
|
- image_templates: ["minetestmapserver/mapserver:{{ .Version }}"]
|
||||||
|
dockerfile: Dockerfile
|
22
Dockerfile
22
Dockerfile
@ -1,20 +1,4 @@
|
|||||||
FROM golang:1.17.6-alpine as builder
|
FROM scratch
|
||||||
|
COPY mapserver /bin/mapserver
|
||||||
RUN apk --no-cache add ca-certificates gcc libc-dev nodejs npm git make
|
|
||||||
|
|
||||||
VOLUME /root/go
|
|
||||||
COPY ./ /server
|
|
||||||
RUN cd /server &&\
|
|
||||||
npm install -g jshint rollup &&\
|
|
||||||
make test jshint all
|
|
||||||
|
|
||||||
FROM alpine:3.15.0
|
|
||||||
RUN apk --no-cache add ca-certificates curl
|
|
||||||
WORKDIR /app
|
|
||||||
COPY --from=builder /server/output/mapserver-linux-x86_64 /bin/mapserver
|
|
||||||
|
|
||||||
HEALTHCHECK --interval=5s --timeout=3s \
|
|
||||||
CMD curl -f http://localhost:8080/api/config || exit 1
|
|
||||||
|
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
CMD ["/bin/mapserver"]
|
ENTRYPOINT ["/bin/mapserver"]
|
||||||
|
64
Makefile
64
Makefile
@ -1,64 +0,0 @@
|
|||||||
OUT_DIR=output
|
|
||||||
VERSION=git-$(shell git rev-parse HEAD)
|
|
||||||
|
|
||||||
|
|
||||||
# -ldflags="-X mapserver/app.Version=1.0"
|
|
||||||
GO_LDFLAGS=-ldflags "-linkmode external -extldflags -static -X mapserver/app.Version=$(VERSION)"
|
|
||||||
GO_LDFLAGS_WIN=-ldflags "-X mapserver/app.Version=$(VERSION)"
|
|
||||||
GO_BUILD=CGO_ENABLED=1 go build
|
|
||||||
|
|
||||||
BINARIES = $(OUT_DIR)/mapserver-linux-x86_64
|
|
||||||
BINARIES += $(OUT_DIR)/mapserver-windows-x86-64.exe
|
|
||||||
BINARIES += $(OUT_DIR)/mapserver-linux-arm
|
|
||||||
|
|
||||||
JS_BUNDLE = public/js/bundle.js
|
|
||||||
|
|
||||||
all: $(JS_BUNDLE) $(OUT_DIR)/mapserver-linux-x86_64
|
|
||||||
|
|
||||||
$(OUT_DIR):
|
|
||||||
mkdir $@
|
|
||||||
|
|
||||||
fmt:
|
|
||||||
go fmt ./...
|
|
||||||
|
|
||||||
test: $(OUT_DIR)
|
|
||||||
go vet ./...
|
|
||||||
go test ./...
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -rf $(JS_BUNDLE) test-output
|
|
||||||
rm -rf $(OUT_DIR)
|
|
||||||
|
|
||||||
jshint:
|
|
||||||
cd public/js && jshint .
|
|
||||||
|
|
||||||
$(JS_BUNDLE):
|
|
||||||
cd public/js && rollup -c rollup.config.js
|
|
||||||
|
|
||||||
$(OUT_DIR)/mapserver-linux-x86_64: $(OUT_DIR)
|
|
||||||
# native (linux x86_64)
|
|
||||||
GOOS=linux GOARCH=amd64 CC=gcc $(GO_BUILD) $(GO_LDFLAGS) -o $@
|
|
||||||
|
|
||||||
$(OUT_DIR)/mapserver-windows-x86-64.exe: $(OUT_DIR)
|
|
||||||
GOARCH=amd64 GOOS=windows CC=x86_64-w64-mingw32-gcc $(GO_BUILD) $(GO_LDFLAGS_WIN) -o $@
|
|
||||||
|
|
||||||
$(OUT_DIR)/mapserver-linux-arm: $(OUT_DIR)
|
|
||||||
# apt install gcc-5-arm-linux-gnueabihf
|
|
||||||
GOARCH=arm GOARM=7 CC=arm-linux-gnueabihf-gcc-8 $(GO_BUILD) $(GO_LDFLAGS) -o $@
|
|
||||||
|
|
||||||
|
|
||||||
release: builder_image $(OUT_DIR) $(MOD_ZIP)
|
|
||||||
# build all with the docker image
|
|
||||||
sudo docker run --rm -i \
|
|
||||||
-v $(shell pwd):/app \
|
|
||||||
-v mapserver-volume:/root/go \
|
|
||||||
-w /app \
|
|
||||||
mapserver-builder \
|
|
||||||
make test jshint release-all VERSION=$(VERSION)
|
|
||||||
# copy generated files to output dir
|
|
||||||
|
|
||||||
builder_image:
|
|
||||||
# build the docker image with all dependencies
|
|
||||||
$(MAKE) -C docker_builder build
|
|
||||||
|
|
||||||
release-all: $(JS_BUNDLE) $(BINARIES)
|
|
38
doc/dev.md
38
doc/dev.md
@ -5,17 +5,17 @@
|
|||||||
|
|
||||||
# Build dependencies
|
# Build dependencies
|
||||||
|
|
||||||
## Basic
|
* go >= 1.16
|
||||||
* go >= 1.11
|
* nodejs >= v17.4.0
|
||||||
* make
|
* npm >= 8.3.0
|
||||||
|
|
||||||
## With crosscompiling (optional)
|
# Create the frontend bundle
|
||||||
Either apt-get:
|
|
||||||
* gcc-mingw-w64
|
|
||||||
* gcc-5-arm-linux-gnueabihf
|
|
||||||
* gcc-i686-linux-gnu
|
|
||||||
|
|
||||||
Or use the docker-builder image in `/docker-builder`
|
```bash
|
||||||
|
cd public
|
||||||
|
npm ci
|
||||||
|
npm run bundle
|
||||||
|
```
|
||||||
|
|
||||||
# Development setup
|
# Development setup
|
||||||
|
|
||||||
@ -56,23 +56,3 @@ pgsql_player_connection = host=localhost port=5432 user=postgres password=enter
|
|||||||
* Change the value `webdev` in the `mapserver.json` to `true`
|
* Change the value `webdev` in the `mapserver.json` to `true`
|
||||||
* Start the server with `go run .` or with debug output: `go run . -debug`
|
* Start the server with `go run .` or with debug output: `go run . -debug`
|
||||||
* The web files in `public/` can now be changed on the fly without restarting the server
|
* The web files in `public/` can now be changed on the fly without restarting the server
|
||||||
|
|
||||||
# All platform build
|
|
||||||
|
|
||||||
Prerequisites:
|
|
||||||
* docker
|
|
||||||
* make
|
|
||||||
|
|
||||||
Building:
|
|
||||||
* Run `make clean all` to build for all supported targets
|
|
||||||
|
|
||||||
The artifacts should now be in the `output` directory
|
|
||||||
|
|
||||||
# Release build
|
|
||||||
|
|
||||||
Prerequisites:
|
|
||||||
* docker
|
|
||||||
* make
|
|
||||||
|
|
||||||
Building:
|
|
||||||
* Run `make all VERSION=X.Y.Z` in the root directory
|
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
FROM ubuntu:hirsute
|
|
||||||
|
|
||||||
# for tzdata
|
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
|
||||||
|
|
||||||
RUN apt-get update
|
|
||||||
|
|
||||||
# cross compile and go stuff
|
|
||||||
RUN apt-get install -y gcc-mingw-w64 gcc-8-arm-linux-gnueabihf gcc-i686-linux-gnu &&\
|
|
||||||
apt-get install -y software-properties-common git golang-go
|
|
||||||
|
|
||||||
# TODO: move this to a separate package.json and docker container
|
|
||||||
# jshint
|
|
||||||
RUN apt-get install -y nodejs npm
|
|
||||||
RUN npm install -g jshint@2.12.0
|
|
||||||
|
|
||||||
# rollup
|
|
||||||
RUN npm install -g rollup@2.35.1
|
|
@ -1,4 +0,0 @@
|
|||||||
TAG=mapserver-builder
|
|
||||||
|
|
||||||
build:
|
|
||||||
sudo docker build . -t $(TAG)
|
|
@ -1,12 +0,0 @@
|
|||||||
Docker builder container
|
|
||||||
===============
|
|
||||||
|
|
||||||
Builds the mapserver with all supported architectures/platforms
|
|
||||||
|
|
||||||
|
|
||||||
Building the builder:
|
|
||||||
```
|
|
||||||
make build
|
|
||||||
```
|
|
||||||
|
|
||||||
This creates an image with the name `mapserver-builder`
|
|
Loading…
Reference in New Issue
Block a user