Skip to content

Commit aae6648

Browse files
committed
Cleanup Xonotic image
Several small tweaks: - Remove server registration with public registry - Switch to Docker build image model
1 parent 49d475a commit aae6648

6 files changed

Lines changed: 27 additions & 21 deletions

File tree

‎.dockerignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ bin
2121
/docs
2222
*.md
2323
*.amd64
24+
/site/public
2425

2526
# Created by .ignore support plugin (hsz.mobi)
2627
### Go template

‎examples/xonotic/Dockerfile‎

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,37 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
FROM debian:stretch
15+
# build
16+
FROM golang:1.11.5 as builder
17+
WORKDIR /go/src/xonotic
1618

1719
RUN apt-get update && apt-get install -y unzip curl
18-
RUN useradd -m xonotic
1920

20-
WORKDIR /home/xonotic
21+
COPY examples/xonotic/main.go .
22+
COPY . /go/src/agones.dev/agones
23+
RUN go build -o wrapper .
24+
2125
RUN curl -o xonotic.zip http://dl.xonotic.org/xonotic-0.8.2.zip && \
2226
unzip xonotic.zip && rm xonotic.zip
2327

28+
# final image
29+
FROM debian:stretch
30+
31+
WORKDIR /home/xonotic
32+
33+
RUN useradd -m xonotic
34+
2435
#
2536
# To learn about setting up a Xonotic dedicated server, read the `readme.txt` in the
2637
# `server` directory after downloading the archive from xonotic.org
2738
#
2839

40+
COPY --from=builder /go/src/xonotic/wrapper .
41+
COPY --from=builder /go/src/xonotic/Xonotic ./Xonotic
42+
2943
RUN mkdir -p ./.xonotic/data && mv /home/xonotic/Xonotic/server/server_linux.sh /home/xonotic/Xonotic/
30-
COPY ./bin/wrapper .
31-
COPY server.cfg ./.xonotic/data
44+
COPY examples/xonotic/server.cfg ./.xonotic/data
45+
3246
RUN chown -R xonotic:xonotic . && chmod +x wrapper
3347

3448
USER xonotic

‎examples/xonotic/Makefile‎

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ REPOSITORY = gcr.io/agones-images
2727

2828
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
2929
project_path := $(dir $(mkfile_path))
30-
agones_path := $(realpath $(project_path)/../..)
31-
image_tag = $(REPOSITORY)/xonotic-example:0.4
30+
root_path := $(realpath $(project_path)/../..)
31+
image_tag = $(REPOSITORY)/xonotic-example:0.5
3232

3333
# _____ _
3434
# |_ _|_ _ _ __ __ _ ___| |_ ___
@@ -38,14 +38,5 @@ image_tag = $(REPOSITORY)/xonotic-example:0.4
3838
# |___/
3939

4040
# Build a docker image for the server, and tag it
41-
build: build-go-binary
42-
docker build $(project_path) --tag=$(image_tag)
43-
44-
# build the go binary with Docker, so you don't have to install anything
45-
build-go-binary: MOUNTPATH="/go/src/agones.dev/agones"
46-
build-go-binary:
47-
docker run --rm -v $(agones_path):$(MOUNTPATH) golang:1.11.1 go build -o $(MOUNTPATH)/examples/xonotic/bin/wrapper agones.dev/agones/examples/xonotic
48-
49-
50-
51-
41+
build:
42+
cd $(root_path) && docker build -f $(project_path)/Dockerfile --tag=$(image_tag) .

‎examples/xonotic/fleet.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ spec:
3535
spec:
3636
containers:
3737
- name: xonotic
38-
image: gcr.io/agones-images/xonotic-example:0.4
38+
image: gcr.io/agones-images/xonotic-example:0.5

‎examples/xonotic/gameserver.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ spec:
2424
spec:
2525
containers:
2626
- name: xonotic
27-
image: gcr.io/agones-images/xonotic-example:0.4
27+
image: gcr.io/agones-images/xonotic-example:0.5
2828
# imagePullPolicy: Always # add for development

‎examples/xonotic/server.cfg‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// make it 'YOUR' server. IF so remove the // from the line start and
1414
// change them to your liking.
1515
16-
sv_public 1 // 0 if the server should not be on the public servers list
16+
sv_public 0 // 0 if the server should not be on the public servers list
1717
//sv_status_privacy 1 // 1 hides IP addresses from "status" replies shown to clients, 0 shows them. Enables players to identify wellknown punks on your server OR is a thread to anonymity.. depending on your point of view :)
1818
hostname "Xonotic Agones $g_xonoticversion Server" // this name will appear on the server list (the $g_xonoticversion gets replaced with the current version)
1919
//sv_motd "" // this message (unless "") is displayed to players on connect

0 commit comments

Comments
 (0)