Skip to content

Commit

Permalink
Docker 👀
Browse files Browse the repository at this point in the history
  • Loading branch information
e3ndr committed Jan 17, 2025
1 parent 65b5c3f commit e5676b8
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: docker

on:
push:

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout code.
uses: actions/checkout@v3

- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: "11"
distribution: "temurin"
cache: maven

- name: Compile the code.
run: mvn clean package

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}

- name: Build & Push image
run: docker buildx build --platform=linux/amd64,linux/arm64/v8,linux/ppc64le,linux/s390x --tag ghcr.io/casterlabs/dbohttp:latest --push .
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM eclipse-temurin:11-jre-ubi9-minimal
WORKDIR /home/container

LABEL org.opencontainers.image.source="https://github.com/casterlabs/dbohttp"

# code
COPY ./target/dbohttp.jar /home/container
COPY ./docker_launch.sh /home/container
RUN chmod +x docker_launch.sh

# entrypoint
CMD [ "./docker_launch.sh" ]
EXPOSE 8000/tcp
10 changes: 10 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
services:
katana:
image: ghcr.io/casterlabs/dbohttp:latest
restart: always
environment:
JWT_SECRET: "abc123"
volumes:
- ./database.sqlite:/home/container/database.sqlite
ports:
- 9000:8000 # Change 9000 to your liking.
6 changes: 6 additions & 0 deletions docker_launch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

rm /home/container/config.json
echo '{"database": {"file": "/home/container/database.sqlite","driver": "SQLITE","accessTimeoutSeconds": 30},"debug": false,"jwtSecret": "$JWT_SECRET","port": 8000,"heartbeatUrl": null,"heartbeatIntervalSeconds": 15,"ssl": null}' >> /home/container/config.json

java -XX:+CrashOnOutOfMemoryError -jar dbohttp.jar

0 comments on commit e5676b8

Please sign in to comment.