Skip to content

Commit 43666e1

Browse files
authored
Add dockerfile and container build (#3)
1 parent 70815dc commit 43666e1

7 files changed

Lines changed: 94 additions & 1 deletion

File tree

.devcontainer/devcontainer.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/java
3+
{
4+
"name": "Java",
5+
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6+
"image": "mcr.microsoft.com/devcontainers/java:3-25-trixie",
7+
8+
"features": {
9+
"ghcr.io/devcontainers/features/java:1": {
10+
"version": "none",
11+
"installMaven": "false",
12+
"installGradle": "true"
13+
}
14+
}
15+
16+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
17+
// "forwardPorts": [],
18+
19+
// Use 'postCreateCommand' to run commands after the container is created.
20+
// "postCreateCommand": "java -version",
21+
22+
// Configure tool-specific properties.
23+
// "customizations": {},
24+
25+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
26+
// "remoteUser": "root"
27+
}

.github/dependabot.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for more information:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
# https://containers.dev/guide/dependabot
6+
7+
version: 2
8+
updates:
9+
- package-ecosystem: "devcontainers"
10+
directory: "/"
11+
schedule:
12+
interval: weekly
13+
- package-ecosystem: "gradle"
14+
directory: "/"
15+
schedule:
16+
interval: "weekly"
17+
- package-ecosystem: "docker"
18+
directory: "/"
19+
schedule:
20+
interval: "weekly"
21+
- package-ecosystem: "github-actions"
22+
directory: "/"
23+
schedule:
24+
interval: "weekly"

.github/workflows/docker.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Publish Docker image
2+
3+
on:
4+
release:
5+
types: [created, prereleased]
6+
7+
jobs:
8+
build-and-push:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
packages: write
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Log in to GHCR
19+
uses: docker/login-action@v3
20+
with:
21+
registry: ghcr.io
22+
username: ${{ github.actor }}
23+
password: ${{ secrets.GITHUB_TOKEN }}
24+
25+
- name: Build and push
26+
uses: docker/build-push-action@v6
27+
with:
28+
context: .
29+
file: ./Dockerfile
30+
push: true
31+
tags: |
32+
ghcr.io/apdevteam/modmail:${{ github.event.release.tag_name }}
33+
ghcr.io/apdevteam/modmail:latest

Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM gradle:8.10-jdk25 AS build
2+
WORKDIR /app
3+
COPY . .
4+
RUN gradle shadowJar --no-daemon
5+
6+
FROM eclipse-temurin:25-jre
7+
WORKDIR /app
8+
COPY --from=build /app/build/libs/ModMail.jar .
9+
CMD ["java", "-jar", "ModMail.jar"]

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ dependencies {
1919
group = "io.github.apdevteam"
2020
version = "0.6.9"
2121
description = "ModMail"
22-
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
22+
java.toolchain.languageVersion = JavaLanguageVersion.of(25)
2323

2424
tasks.jar {
2525
manifest {

0 commit comments

Comments
 (0)