Skip to content

Commit

Permalink
build: moved jlink build inside the Docker image build, so building t…
Browse files Browse the repository at this point in the history
…he Docker image works on any host OS

Problem was that jlink produces OS-specific artifacts, so you couldn't make a functional Docker image on Windows.
Final Docker image size has also been reduced, roughly from 240MB to 170MB, by using Alpine as the new base image.
Support for Debian Stretch ended on the 30th of June 2022.
  • Loading branch information
madsboddum committed Aug 18, 2023
1 parent e425c60 commit 81d0883
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.git
.gradle
build
log
mongo_data
pswgcommon/build
6 changes: 0 additions & 6 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@ jobs:
- uses: actions/checkout@v1
with:
submodules: true
- name: Set up JDK 18
uses: actions/setup-java@v1
with:
java-version: 18
- name: Build
run: ./gradlew --no-daemon clean test jlink
- name: Docker Login
run: docker login docker.pkg.github.com -u "${{ secrets.DOCKER_USER }}" -p "${{ secrets.DOCKER_PASS }}"
- name: Docker Build & Push
Expand Down
12 changes: 9 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
FROM debian:stretch-slim
FROM eclipse-temurin:18.0.2.1_1-jdk-alpine AS builder
WORKDIR /holocore
ADD . /holocore

RUN ./gradlew --no-daemon jlink

FROM alpine:3.18.3 AS runner

# Adds necessary Holocore files
RUN mkdir /holocore
ADD build/holocore/ /holocore
COPY --from=builder /holocore/build/holocore/ /holocore
ADD serverdata/ /holocore/serverdata

# Sets up networking
EXPOSE 44463/tcp

# Sets up timezone - default timezone can be overridden by setting TZ environment variable.
RUN apt-get install -y tzdata
RUN apk add --no-cache tzdata
ENV TZ=UTC

# Sets up execution
Expand Down

0 comments on commit 81d0883

Please sign in to comment.