Skip to content

Commit

Permalink
Build and publish docker images.
Browse files Browse the repository at this point in the history
  • Loading branch information
noeppi-noeppi committed Jun 29, 2024
1 parent 4364970 commit f4bd9e9
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,28 @@ jobs:
with:
distribution: 'temurin'
java-version: '21'
- name: 'Build Docker Image'
run: |
docker build \
--pull --no-cache \
--build-arg="VERSION=${{ github.ref_name }}" \
-t "ghcr.io/moddingx/modbadges:${{ github.ref_name }}" \
-t "ghcr.io/moddingx/modbadges:latest" \
.
- name: 'Build'
run: |
./gradlew \
-Pversion=${{ github.ref_name }} \
-PmoddingxUsername=${{ secrets.PUBLISH_USER }} \
-PmoddingxPassword=${{ secrets.PUBLISH_PASSWORD }} \
build publish
- name: 'Login to package registry'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: 'Publish Docker Image'
run: |
docker push "ghcr.io/moddingx/modbadges:${{ github.ref_name }}"
docker push "ghcr.io/moddingx/modbadges:latest"
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM gradle:8-jdk21 AS build
ARG VERSION
COPY . /data
WORKDIR /data
RUN gradle -Pversion="${VERSION}" --no-daemon clean build
WORKDIR /dist
RUN tar --strip-components=1 -xf "/data/build/distributions/ModBadges-${VERSION}.tar"

FROM eclipse-temurin:21
COPY --from=build --link /dist/ /data/
ENV JAVA_OPTS="-server"
CMD [ "/data/bin/ModBadges", "--no-ssl", "--docker" ]

0 comments on commit f4bd9e9

Please sign in to comment.