Skip to content

Commit e6da980

Browse files
committed
Containerize TabletopGames
1 parent c0f6a3c commit e6da980

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

.github/workflows/release.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: release
2+
on:
3+
push:
4+
tags:
5+
- 'v*'
6+
jobs:
7+
release:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v2
12+
- name: Set up QEMU
13+
uses: docker/setup-qemu-action@v2
14+
- name: Set up Docker Buildx
15+
uses: docker/setup-buildx-action@v2
16+
- name: Login to GitHub Container Registry
17+
uses: docker/login-action@v2
18+
with:
19+
registry: ghcr.io
20+
username: ${{ github.repository_owner }}
21+
password: ${{ secrets.GITHUB_TOKEN }}
22+
- name: Build and Push Docker Image
23+
uses: docker/build-push-action@v3
24+
with:
25+
context: "{{defaultContext}}"
26+
platforms: linux/amd64,linux/arm64
27+
push: true
28+
tags: |
29+
ghcr.io/${{ github.repository_owner }}/tag:${{ github.ref_name }}
30+
ghcr.io/${{ github.repository_owner }}/tag:latest

Dockerfile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Build the application using the OpenJDK development image
2+
FROM registry.suse.com/bci/openjdk-devel:21
3+
4+
# Get the TabletopGames project sources
5+
ADD . /TabletopGames
6+
WORKDIR /TabletopGames
7+
8+
# Start from scratch
9+
RUN mvn clean
10+
# Compile TAG
11+
RUN mvn compile
12+
# Create JARs TAG
13+
RUN mvn package
14+
15+
# Bundle the application into OpenJDK runtime image
16+
FROM registry.suse.com/bci/openjdk:21
17+
18+
# Copy over only the project (with generated JARs now)
19+
COPY --from=0 /TabletopGames/json /json
20+
COPY --from=0 /TabletopGames/data /data
21+
COPY --from=0 /TabletopGames/target/RunGames-jar-with-dependencies.jar /RunGames-jar-with-dependencies.jar
22+
23+
ENTRYPOINT ["java", "-jar", "/RunGames-jar-with-dependencies.jar"]

0 commit comments

Comments
 (0)