Skip to content

Commit

Permalink
Dockering
Browse files Browse the repository at this point in the history
  • Loading branch information
Foxikle committed Jun 18, 2024
1 parent 4c2f2c8 commit 6188a9a
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 1 deletion.
44 changes: 44 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Build and push Docker Image
run-name: Deploy Docker image to GHCR by @${{ github.actor }}

env:
GHCR_TOKEN: ${{ secrets.GHCR_TOKEN }}

on:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
env:
GHCR_TOKEN: ${{ secrets.GHCR_TOKEN }}

steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '21'

# - run: chmod +x gradlew

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Assemble Jar
run: ./gradlew -Dorg.gradle.jvmargs=--enable-preview assemble
env:
REPO_USERNAME: ${{ secrets.REPO_USERNAME }}
REPO_PASSWORD: ${{ secrets.REPO_PASSWORD }}

- name: Build Docker Image
run: |
docker build -t cytosis -f docker/basic/Dockerfile .
- name: Push Docker Image
run: |
docker login ghcr.io -u CytonicMC -p $GHCR_TOKEN
docker push ghcr.io/CytonicMC/cytosis:latest
4 changes: 3 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ tasks {
archiveFileName.set("cytosis.jar")
archiveClassifier.set("")
destinationDirectory.set(
file(providers.gradleProperty("server_dir").orElse(destinationDirectory.get().toString()))
file(
providers.gradleProperty("server_dir").orElse(destinationDirectory.get().toString())
)
)
}
}
Expand Down
14 changes: 14 additions & 0 deletions docker/basic/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM eclipse-temurin:21-jre-jammy
LABEL authors="CytonicMC"

# Set the working directory
WORKDIR /app

# Copy cytosis Jar
COPY ../../build/libs/cytosis.jar .

# Expose the port
EXPOSE 25565

# Run the java
CMD ["java", "-DSERVER_PORT=25565", "-jar", "--enable-preview", "cytosis.jar"]

0 comments on commit 6188a9a

Please sign in to comment.