Compare commits
2 Commits
f80e6d9ea4
...
b5cb254c2d
| Author | SHA1 | Date | |
|---|---|---|---|
| b5cb254c2d | |||
| de98c400c7 |
71
.gitea/workflows/docker.yaml
Normal file
71
.gitea/workflows/docker.yaml
Normal file
@@ -0,0 +1,71 @@
|
||||
name: Build Docker Image
|
||||
run-name: ${{ gitea.actor }} building ${{ gitea.ref_name }}
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- dev
|
||||
|
||||
jobs:
|
||||
Docker-Build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Clone Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Build docker image
|
||||
run: docker build -t occ .
|
||||
|
||||
- name: Store tag date
|
||||
run: |
|
||||
TAG=$(date +%Y%m%d_%H%M)_${{ gitea.ref_name }}
|
||||
echo $TAG > /tmp/tag
|
||||
echo Using '"'$TAG'"' as tag.
|
||||
|
||||
- name: Tag image for upload
|
||||
run: |
|
||||
TAG=$(cat /tmp/tag)
|
||||
docker tag occ ${{ secrets.REGISTRY_PATH }}/occ:${{ gitea.ref_name }}
|
||||
docker tag occ ${{ secrets.REGISTRY_PATH }}/occ:$TAG
|
||||
|
||||
- name: Login to registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ${{ secrets.REGISTRY_PATH }}
|
||||
username: ${{ secrets.REGISTRY_USER }}
|
||||
password: ${{ secrets.REGISTRY_PASS }}
|
||||
|
||||
- name: Push to registry
|
||||
run: |
|
||||
TAG=$(cat /tmp/tag)
|
||||
docker push ${{ secrets.REGISTRY_PATH }}/occ:${{ gitea.ref_name }}
|
||||
docker push ${{ secrets.REGISTRY_PATH }}/occ:$TAG
|
||||
|
||||
Clean-Registry:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Get tag list
|
||||
run: |
|
||||
TAGS="$(curl -s -u "${{ secrets.REGISTRY_USER }}:${{ secrets.REGISTRY_PASS }}" https://${{ secrets.REGISTRY_PATH }}/v2/occ/tags/list | jq -r ".tags[]")"
|
||||
COUNT=$(echo "$TAGS" | wc -l)
|
||||
if [ $COUNT -gt 10 ]; then
|
||||
REMAIN=$((COUNT - 10))
|
||||
echo "$TAGS" | head -n $REMAIN > /tmp/old_tags
|
||||
else
|
||||
echo less than 10 tags, skipping cleanup
|
||||
echo "" > /tmp/old_tags
|
||||
fi
|
||||
|
||||
- name: Remove tags
|
||||
run: |
|
||||
cat /tmp/old_tags | while read TAG; do
|
||||
if [ -n "$TAG" ]; then
|
||||
DIGEST=$(curl -u "${{ secrets.REGISTRY_USER }}:${{ secrets.REGISTRY_PASS }}" -sS -H 'Accept: application/vnd.docker.distribution.manifest.v2+json' -o /dev/null -w '%header{Docker-Content-Digest}' https://${{ secrets.REGISTRY_PATH }}/v2/occ/manifests/$TAG)
|
||||
if [ -n "$DIGEST" ]; then
|
||||
echo about to delete $TAG
|
||||
curl -u "${{ secrets.REGISTRY_USER }}:${{ secrets.REGISTRY_PASS }}" -sS -X DELETE https://${{ secrets.REGISTRY_PATH }}/v2/occ/manifests/$DIGEST
|
||||
else
|
||||
echo failed to get digest for $TAG
|
||||
fi
|
||||
fi
|
||||
done
|
||||
22
Dockerfile
22
Dockerfile
@@ -1,26 +1,18 @@
|
||||
FROM alpine AS build
|
||||
RUN apk update \
|
||||
&& apk add openjdk21-jre
|
||||
RUN apk add bash clang-extra-tools git
|
||||
RUN apk update
|
||||
RUN apk add openjdk21-jre
|
||||
RUN apk add bash git
|
||||
ADD . /OpenCloudCal
|
||||
WORKDIR /OpenCloudCal
|
||||
RUN VERSION=$(clang-format --version | sed -e "s/.* //g") && sed -i "s|clangFormat(.*).style|clangFormat(\"$VERSION\").style|g" build.gradle.kts
|
||||
RUN ./gradlew build
|
||||
RUN mv *app/build/distributions/*.zip /occ.zip
|
||||
|
||||
FROM alpine
|
||||
RUN apk update \
|
||||
&& apk add bash openjdk21-jre
|
||||
RUN apk update apk add bash openjdk21-jre
|
||||
COPY --from=build /occ.zip /opt/occ.zip
|
||||
RUN cd /opt \
|
||||
&& unzip occ.zip \
|
||||
&& mv de.srsoftware.cal.app occ \
|
||||
&& rm *.zip
|
||||
RUN cd /opt && unzip occ.zip && mv de.srsoftware.cal.app occ && rm *.zip
|
||||
WORKDIR /opt/occ
|
||||
RUN mkdir lib/importers \
|
||||
&& cp lib/*importer*jar lib/importers/
|
||||
RUN adduser -S occ \
|
||||
&& ln -s /data /home/occ/.config
|
||||
|
||||
RUN mkdir lib/importers && cp lib/*importer*jar lib/importers/
|
||||
RUN adduser -S occ && ln -s /data /home/occ/.config
|
||||
USER occ
|
||||
ENTRYPOINT /opt/occ/bin/de.srsoftware.cal.app
|
||||
@@ -11,7 +11,7 @@ spotless {
|
||||
target("**/src/**/java/**/*.java")
|
||||
removeUnusedImports()
|
||||
importOrder()
|
||||
licenseHeader("/* © SRSoftware 2024 */")
|
||||
licenseHeader("/* © SRSoftware 2026 */")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* © SRSoftware 2024 */
|
||||
/* © SRSoftware 2026 */
|
||||
package de.srsoftware.cal.api;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* © SRSoftware 2024 */
|
||||
/* © SRSoftware 2026 */
|
||||
package de.srsoftware.cal.api;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* © SRSoftware 2024 */
|
||||
/* © SRSoftware 2026 */
|
||||
package de.srsoftware.cal.api;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* © SRSoftware 2024 */
|
||||
/* © SRSoftware 2026 */
|
||||
package de.srsoftware.cal.api;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* © SRSoftware 2024 */
|
||||
/* © SRSoftware 2026 */
|
||||
package de.srsoftware.cal.api;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* © SRSoftware 2024 */
|
||||
/* © SRSoftware 2026 */
|
||||
package de.srsoftware.cal.app;
|
||||
|
||||
import static java.lang.System.Logger.Level.*;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* © SRSoftware 2024 */
|
||||
/* © SRSoftware 2026 */
|
||||
package de.srsoftware.cal.app;
|
||||
|
||||
import static java.lang.System.Logger.Level.*;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* © SRSoftware 2024 */
|
||||
/* © SRSoftware 2026 */
|
||||
package de.srsoftware.cal;
|
||||
|
||||
import static de.srsoftware.cal.Util.*;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* © SRSoftware 2024 */
|
||||
/* © SRSoftware 2026 */
|
||||
package de.srsoftware.cal;
|
||||
|
||||
import static de.srsoftware.cal.Util.*;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* © SRSoftware 2024 */
|
||||
/* © SRSoftware 2026 */
|
||||
package de.srsoftware.cal;
|
||||
|
||||
import static de.srsoftware.cal.Util.url;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* © SRSoftware 2024 */
|
||||
/* © SRSoftware 2026 */
|
||||
package de.srsoftware.cal;
|
||||
|
||||
import static de.srsoftware.tools.Error.error;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* © SRSoftware 2024 */
|
||||
/* © SRSoftware 2026 */
|
||||
package de.srsoftware.cal;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* © SRSoftware 2024 */
|
||||
/* © SRSoftware 2026 */
|
||||
package de.srsoftware.cal.db;
|
||||
|
||||
import de.srsoftware.cal.api.Appointment;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* © SRSoftware 2024 */
|
||||
/* © SRSoftware 2026 */
|
||||
package de.srsoftware.cal.db;
|
||||
|
||||
public class Fields {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* © SRSoftware 2024 */
|
||||
/* © SRSoftware 2026 */
|
||||
package de.srsoftware.cal.db;
|
||||
|
||||
import static de.srsoftware.cal.Util.extractCoords;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* © SRSoftware 2024 */
|
||||
/* © SRSoftware 2026 */
|
||||
package de.srsoftware.cal.db;
|
||||
|
||||
import de.srsoftware.tools.Error;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* © SRSoftware 2024 */
|
||||
/* © SRSoftware 2026 */
|
||||
package de.srsoftware.cal.db;
|
||||
|
||||
import de.srsoftware.tools.Error;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* © SRSoftware 2024 */
|
||||
/* © SRSoftware 2026 */
|
||||
package de.srsoftware.cal.importer.erfurt;
|
||||
|
||||
import static de.srsoftware.cal.Util.url;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* © SRSoftware 2024 */
|
||||
/* © SRSoftware 2026 */
|
||||
package de.srsoftware.cal.importer.erfurt;
|
||||
|
||||
import static de.srsoftware.cal.Util.parseGermanTime;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* © SRSoftware 2024 */
|
||||
/* © SRSoftware 2026 */
|
||||
package de.srsoftware.cal.importer.erfurt;
|
||||
|
||||
import static de.srsoftware.cal.Util.parseGermanTime;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* © SRSoftware 2024 */
|
||||
/* © SRSoftware 2026 */
|
||||
package de.srsoftware.cal.importer.gera;
|
||||
|
||||
import static de.srsoftware.cal.Util.*;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* © SRSoftware 2024 */
|
||||
/* © SRSoftware 2026 */
|
||||
package de.srsoftware.cal.importer.jena;
|
||||
|
||||
import static de.srsoftware.cal.Util.extractBackgroundImage;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* © SRSoftware 2024 */
|
||||
/* © SRSoftware 2026 */
|
||||
package de.srsoftware.cal.importer.jena;
|
||||
|
||||
import static de.srsoftware.cal.Util.parseGermanDate;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* © SRSoftware 2024 */
|
||||
/* © SRSoftware 2026 */
|
||||
package de.srsoftware.cal.importer.jena;
|
||||
|
||||
import static de.srsoftware.cal.Util.parseGermanTime;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* © SRSoftware 2024 */
|
||||
/* © SRSoftware 2026 */
|
||||
package de.srsoftware.cal.importer.jena;
|
||||
|
||||
import static de.srsoftware.cal.Util.*;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* © SRSoftware 2024 */
|
||||
/* © SRSoftware 2026 */
|
||||
package de.srsoftware.cal.importer.jena;
|
||||
|
||||
import static de.srsoftware.tools.Error.error;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* © SRSoftware 2024 */
|
||||
/* © SRSoftware 2026 */
|
||||
package de.srsoftware.cal.importer.jena;
|
||||
|
||||
import static de.srsoftware.cal.Util.parseGermanTime;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* © SRSoftware 2024 */
|
||||
/* © SRSoftware 2026 */
|
||||
package de.srsoftware.cal.importer.leipzig;
|
||||
|
||||
import static de.srsoftware.cal.Util.parseGermanTime;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* © SRSoftware 2024 */
|
||||
/* © SRSoftware 2026 */
|
||||
package de.srsoftware.cal.importer.neustadt;
|
||||
|
||||
import static de.srsoftware.cal.Util.parseGermanDate;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* © SRSoftware 2024 */
|
||||
/* © SRSoftware 2026 */
|
||||
package de.srsoftware.cal.importer.weimar;
|
||||
|
||||
import static de.srsoftware.tools.Error.error;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* © SRSoftware 2024 */
|
||||
/* © SRSoftware 2026 */
|
||||
package de.srsoftware.cal.importer.weimar;
|
||||
|
||||
import static de.srsoftware.cal.Util.parseGermanDate;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* © SRSoftware 2024 */
|
||||
/* © SRSoftware 2026 */
|
||||
package de.srsoftware.cal.importer.weimar;
|
||||
|
||||
import static de.srsoftware.tools.Result.transform;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* © SRSoftware 2024 */
|
||||
/* © SRSoftware 2026 */
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* © SRSoftware 2024 */
|
||||
/* © SRSoftware 2026 */
|
||||
package de.srsoftware.cal;
|
||||
|
||||
import static de.srsoftware.cal.Util.extractCoords;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* © SRSoftware 2024 */
|
||||
/* © SRSoftware 2026 */
|
||||
package de.srsoftware.cal;
|
||||
|
||||
import static de.srsoftware.tools.Optionals.nullable;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* © SRSoftware 2024 */
|
||||
/* © SRSoftware 2026 */
|
||||
package de.srsoftware.cal;
|
||||
|
||||
import com.sun.net.httpserver.HttpExchange;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* © SRSoftware 2024 */
|
||||
/* © SRSoftware 2026 */
|
||||
package de.srsoftware.cal;
|
||||
|
||||
import com.sun.net.httpserver.HttpExchange;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* © SRSoftware 2024 */
|
||||
/* © SRSoftware 2026 */
|
||||
import static de.srsoftware.cal.ApiEndpoint.parseDate;
|
||||
import static java.time.LocalDateTime.of;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* © SRSoftware 2024 */
|
||||
/* © SRSoftware 2026 */
|
||||
import static de.srsoftware.cal.ApiEndpoint.parsePast;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user