diff --git a/.gitea/workflows/container.yaml b/.gitea/workflows/container.yaml new file mode 100644 index 0000000..e48b3fd --- /dev/null +++ b/.gitea/workflows/container.yaml @@ -0,0 +1,12 @@ +name: Build Multiarch Container Image +on: [push] +jobs: + call-reusable-workflow: + uses: container/multiarch-build-workflow/.gitea/workflows/build.yaml@main + with: + repository: ${{ gitea.repository }} + ref_name: ${{ gitea.ref_name }} + sha: ${{ gitea.sha }} + registry_url: ${{ secrets.REGISTRY_URL }} + registry_user: ${{ secrets.REGISTRY_USER }} + registry_pw: ${{ secrets.REGISTRY_PW }} diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index a477804..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,19 +0,0 @@ -variables: - CONTAINER_NAME: thallian/airsonic - -build: - stage: build - image: - name: gcr.io/kaniko-project/executor:debug - entrypoint: [""] - script: - - mkdir -p /kaniko/.docker - - echo "{\"auths\":{\"$CI_REGISTRY\":{\"auth\":\"$(printf "%s:%s" "$CI_REGISTRY_USER" "$CI_REGISTRY_PASSWORD" | base64 | tr -d '\n')\"}}}" > /kaniko/.docker/config.json - - >- - /kaniko/executor - --cache=false - --context "$CI_PROJECT_DIR" - --dockerfile "$CI_PROJECT_DIR/Dockerfile" - --destination "$CONTAINER_NAME:$CI_COMMIT_SHA" - --destination "$CONTAINER_NAME:$CI_COMMIT_REF_NAME" - --destination "$CONTAINER_NAME:latest" diff --git a/Dockerfile b/Containerfile similarity index 70% rename from Dockerfile rename to Containerfile index e42dab8..231e31f 100644 --- a/Dockerfile +++ b/Containerfile @@ -1,31 +1,33 @@ -FROM alpine:3.15 AS builder +FROM docker.io/alpine:3.19 AS builder -ENV VERSION=11.0.0-SNAPSHOT.20220213174344 +ENV VERSION=11.0.0-SNAPSHOT.20230217142243 RUN apk add --no-cache \ - openjdk17-jdk \ - maven \ - git + openjdk21-jdk \ + maven \ + git RUN git clone https://github.com/airsonic-advanced/airsonic-advanced WORKDIR /airsonic-advanced +COPY mvn.patch . RUN git checkout "$VERSION" -RUN mvn package +RUN git apply mvn.patch +RUN mvn package -DskipTests -FROM thallian/alpine-s6:latest +FROM docker.io/thallian/confd-env:3.19-3.1.6.2 ENV JAVA_OPTIONS=-Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 ENV AIRSONIC_DIR=/home/airsonic RUN apk add --no-cache \ - ca-certificates \ - openssl \ - ffmpeg \ - flac \ - opus \ - lame \ - openjdk17-jre-headless + ca-certificates \ + openssl \ + ffmpeg \ + flac \ + opus \ + lame \ + openjdk21-jre-headless RUN addgroup -g 2222 airsonic RUN adduser -h "$AIRSONIC_DIR" -S -D -u 2222 -G airsonic airsonic diff --git a/README.md b/README.md index 0d77f86..6e3e76b 100644 --- a/README.md +++ b/README.md @@ -6,5 +6,19 @@ - `/home/airsonic/playlists` - `/home/airsonic/podcasts` +# Environment Variables +## DB_URL + +JDBC url for the postgres conection. + +## DB_USER +- default: airsonic + +Username with which to connect to the database. + +## DB_PASSWORD + +Password for the databse connection. + # Ports - 8080 diff --git a/mvn.patch b/mvn.patch new file mode 100644 index 0000000..35fda35 --- /dev/null +++ b/mvn.patch @@ -0,0 +1,8 @@ +diff --git a/.mvn/maven.config b/.mvn/maven.config +index 7bd692d7..89f6445d 100644 +--- a/.mvn/maven.config ++++ b/.mvn/maven.config +@@ -1 +1,2 @@ +---settings ./.mvn/settings.xml ++--settings ++./.mvn/settings.xml diff --git a/rootfs/etc/confd/conf.d/airsonic.properties.toml b/rootfs/etc/confd/conf.d/airsonic.properties.toml new file mode 100644 index 0000000..6f6084a --- /dev/null +++ b/rootfs/etc/confd/conf.d/airsonic.properties.toml @@ -0,0 +1,6 @@ +[template] +src = "airsonic.properties.tmpl" +dest = "/home/airsonic/data/airsonic.properties" +gid = 2222 +uid = 2222 +mode = "0660" diff --git a/rootfs/etc/confd/templates/airsonic.properties.tmpl b/rootfs/etc/confd/templates/airsonic.properties.tmpl new file mode 100644 index 0000000..1b785c5 --- /dev/null +++ b/rootfs/etc/confd/templates/airsonic.properties.tmpl @@ -0,0 +1,6 @@ +spring.datasource.driver-class-name=org.postgresql.Driver +spring.datasource.url={{ getenv "DB_URL" }} +spring.datasource.username={{ getenv "DB_USER" "airsonic" }} +spring.datasource.password={{ getenv "DB_PASSWORD" }} +spring.liquibase.parameters.userTableQuote=" +server.forward-headers-strategy=native diff --git a/rootfs/etc/s6-overlay/s6-rc.d/airsonic/dependencies b/rootfs/etc/s6-overlay/s6-rc.d/airsonic/dependencies new file mode 100644 index 0000000..7ba7514 --- /dev/null +++ b/rootfs/etc/s6-overlay/s6-rc.d/airsonic/dependencies @@ -0,0 +1 @@ +confd