Commit bfb3b4b3 authored by Finn Herzfeld's avatar Finn Herzfeld 🌵

Merge branch 'master' into 'master'

Use multi-stage build for smaller docker image size

See merge request thefinn93/signald!15
parents 766dd64f 8435353c
Pipeline #3887 passed with stages
in 6 minutes and 6 seconds
FROM gradle:jdk${JAVA_VERSION:-12}
FROM gradle:jdk${JAVA_VERSION:-8} AS build
COPY . /tmp/src
WORKDIR /tmp/src
......@@ -6,16 +6,18 @@ WORKDIR /tmp/src
RUN gradle -Dorg.gradle.daemon=false build
RUN tar xf build/distributions/signald.tar -C /opt
FROM gradle:jre${JAVA_VERSION:-8}-alpine AS release
USER root
WORKDIR /opt
COPY --from=build /opt/signald .
RUN ln -sf /opt/signald/bin/signald /usr/local/bin/
# basically `make setup`
RUN mkdir -p /var/run/signald
RUN chown gradle /var/run/signald
# Cleanup
RUN rm -rf /tmp/src
USER gradle
WORKDIR /home/gradle
......
......@@ -50,9 +50,9 @@ public class Util {
public static String redact(String in) {
if(in.length() < 2) {
return "*".repeat(in.length());
return new String(new char[in.length()]).replace("\0", "*");
}
int unredactAfter = in.length()-2;
return "*".repeat(unredactAfter) + in.substring(unredactAfter);
return new String(new char[unredactAfter]).replace("\0", "*") + in.substring(unredactAfter);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment