diff --git a/.drone.yml b/.drone.yml
index 940a6dc..d8c9dcb 100644
--- a/.drone.yml
+++ b/.drone.yml
@@ -1,12 +1,19 @@
kind: pipeline
type: docker
name: default
-
steps:
- - name: test
+ - name: build
image: maven:3.8-openjdk-18-slim
commands:
- mvn clean install -DskipTests=true -Dmaven.javadoc.skip=true -B -V
+ when:
+ branch:
+ include:
+ - master
+ - feature/*
+ - name: test
+ image: maven:3.8-openjdk-18-slim
+ commands:
- mvn test -B
when:
branch:
@@ -25,4 +32,40 @@ steps:
- master
event:
exclude:
- - pull_request
+ - pull_request
+ - name: build_docker_image
+ image: plugins/docker
+ settings:
+ registry: gittr.ch
+ username: manuel
+ password:
+ from_secret: docker-token
+ repo: gittr.ch/java/labyrinth
+ tags:
+ - latest
+ dockerfile: docker/Dockerfile
+ when:
+ branch:
+ - master
+ event:
+ exclude:
+ - pull_request
+ - tag
+ - name: build_docker_image_release
+ image: plugins/docker
+ settings:
+ registry: gittr.ch
+ username: manuel
+ password:
+ from_secret: docker-token
+ repo: gittr.ch/java/labyrinth
+ tags:
+ - latest
+ - ${DRONE_TAG}
+ dockerfile: docker/Dockerfile
+ when:
+ branch:
+ - master
+ event:
+ include:
+ - tag
diff --git a/docker/Dockerfile b/docker/Dockerfile
index abccd12..8c0219c 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -1,4 +1,4 @@
-FROM openjdk:11
+FROM openjdk:17-slim
COPY target/labyrinth-server-*.jar /app/app.jar
diff --git a/pom.xml b/pom.xml
index 3518f8b..ecd2143 100644
--- a/pom.xml
+++ b/pom.xml
@@ -18,6 +18,8 @@
1.4.6
1.18.26
2.0.5
+ 17
+ 17
diff --git a/src/main/java/ch/fritteli/labyrinth/server/LabyrinthServer.java b/src/main/java/ch/fritteli/labyrinth/server/LabyrinthServer.java
index 689d9bc..aab20f6 100644
--- a/src/main/java/ch/fritteli/labyrinth/server/LabyrinthServer.java
+++ b/src/main/java/ch/fritteli/labyrinth/server/LabyrinthServer.java
@@ -105,15 +105,15 @@ public class LabyrinthServer {
exchange.sendResponseHeaders(302, -1);
return;
}
- final Labyrinth labyrinth = new Labyrinth(width, height, id);
final byte[] render;
try {
+ final Labyrinth labyrinth = new Labyrinth(width, height, id);
render = output.render(labyrinth);
} catch (Exception e) {
responseHeaders.add("Content-type", "text/plain; charset=UTF-8");
exchange.sendResponseHeaders(500, 0);
final OutputStream responseBody = exchange.getResponseBody();
- responseBody.write(("Error: " + e).getBytes(StandardCharsets.UTF_8));
+ responseBody.write(("Error: " + e.getMessage()).getBytes(StandardCharsets.UTF_8));
responseBody.flush();
return;
}