feature/docker #3
4 changed files with 51 additions and 6 deletions
47
.drone.yml
47
.drone.yml
|
@ -1,12 +1,19 @@
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
name: default
|
name: default
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: test
|
- name: build
|
||||||
image: maven:3.8-openjdk-18-slim
|
image: maven:3.8-openjdk-18-slim
|
||||||
commands:
|
commands:
|
||||||
- mvn clean install -DskipTests=true -Dmaven.javadoc.skip=true -B -V
|
- 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
|
- mvn test -B
|
||||||
when:
|
when:
|
||||||
branch:
|
branch:
|
||||||
|
@ -26,3 +33,39 @@ steps:
|
||||||
event:
|
event:
|
||||||
exclude:
|
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
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
FROM openjdk:11
|
FROM openjdk:17-slim
|
||||||
|
|
||||||
COPY target/labyrinth-server-*.jar /app/app.jar
|
COPY target/labyrinth-server-*.jar /app/app.jar
|
||||||
|
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -18,6 +18,8 @@
|
||||||
<logback.version>1.4.6</logback.version>
|
<logback.version>1.4.6</logback.version>
|
||||||
<lombok.version>1.18.26</lombok.version>
|
<lombok.version>1.18.26</lombok.version>
|
||||||
<slf4j.version>2.0.5</slf4j.version>
|
<slf4j.version>2.0.5</slf4j.version>
|
||||||
|
<java.source.version>17</java.source.version>
|
||||||
|
<java.target.version>17</java.target.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
|
@ -105,15 +105,15 @@ public class LabyrinthServer {
|
||||||
exchange.sendResponseHeaders(302, -1);
|
exchange.sendResponseHeaders(302, -1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final Labyrinth labyrinth = new Labyrinth(width, height, id);
|
|
||||||
final byte[] render;
|
final byte[] render;
|
||||||
try {
|
try {
|
||||||
|
final Labyrinth labyrinth = new Labyrinth(width, height, id);
|
||||||
render = output.render(labyrinth);
|
render = output.render(labyrinth);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
responseHeaders.add("Content-type", "text/plain; charset=UTF-8");
|
responseHeaders.add("Content-type", "text/plain; charset=UTF-8");
|
||||||
exchange.sendResponseHeaders(500, 0);
|
exchange.sendResponseHeaders(500, 0);
|
||||||
final OutputStream responseBody = exchange.getResponseBody();
|
final OutputStream responseBody = exchange.getResponseBody();
|
||||||
responseBody.write(("Error: " + e).getBytes(StandardCharsets.UTF_8));
|
responseBody.write(("Error: " + e.getMessage()).getBytes(StandardCharsets.UTF_8));
|
||||||
responseBody.flush();
|
responseBody.flush();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue