Skip to content

Commit

Permalink
Add Dockerfile and publishing to DockerHub
Browse files Browse the repository at this point in the history
  • Loading branch information
GregHib committed Mar 19, 2024
1 parent 2ed53b8 commit de227bc
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 4 deletions.
26 changes: 22 additions & 4 deletions .github/workflows/create_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
with:
java-version: '19'
distribution: 'temurin'
java-version: "19"
distribution: "temurin"
architecture: x64
cache: 'gradle'
cache: "gradle"
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Grant permissions to gradlew
Expand All @@ -30,4 +30,22 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run:
gh release create -d ${{ github.ref_name }} ./game/build/distributions/void-${{ env.build_version }}.zip
gh release create -d ${{ github.ref_name }} ./game/build/distributions/void-${{ env.build_version }}.zip
- name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: greghib/void
- name: Build and push Docker image
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM eclipse-temurin:19-jdk-alpine
LABEL authors="Greg"
EXPOSE 43594/tcp

RUN mkdir /app
WORKDIR /app/

# Copy JAR file
COPY ./game/build/libs/void-server-*.jar /app/void-server.jar

# Copy configuration and cache files
COPY ./data/map/ /app/data/map/
COPY ./data/spawns/ /app/data/spawns/
COPY ./data/definitions/ /app/data/definitions/
COPY ./data/cache/ /app/data/cache/

CMD ["java", "-jar", "void-server.jar"]
8 changes: 8 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: "3.8"
services:
void:
image: greghib/void
volumes:
- ./data/saves/:/app/data/saves
ports:
- "43594:43594"

0 comments on commit de227bc

Please sign in to comment.