Allow to set custom PUID/PGID

This commit is contained in:
CrazyMax
2019-11-17 07:15:23 +01:00
parent fdb28342f3
commit 171e0c32f1
3 changed files with 67 additions and 36 deletions

View File

@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:experimental
FROM --platform=${TARGETPLATFORM:-linux/amd64} adoptopenjdk:12-jre-hotspot
FROM --platform=${TARGETPLATFORM:-linux/amd64} adoptopenjdk:12-jre-hotspot as suexec
ARG BUILD_DATE
ARG VCS_REF
@@ -9,6 +9,21 @@ ARG TARGETPLATFORM
ARG BUILDPLATFORM
RUN printf "I am running on ${BUILDPLATFORM:-linux/amd64}, building for ${TARGETPLATFORM:-linux/amd64}\n$(uname -a)\n"
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
gcc \
libc-dev \
&& curl -o /usr/local/bin/su-exec.c https://raw.githubusercontent.com/ncopa/su-exec/master/su-exec.c \
&& gcc -Wall /usr/local/bin/su-exec.c -o/usr/local/bin/su-exec \
&& chown root:root /usr/local/bin/su-exec \
&& chmod 0755 /usr/local/bin/su-exec
FROM --platform=${TARGETPLATFORM:-linux/amd64} adoptopenjdk:12-jre-hotspot
ARG BUILD_DATE
ARG VCS_REF
ARG VERSION
LABEL maintainer="CrazyMax" \
org.label-schema.build-date=$BUILD_DATE \
org.label-schema.name="jetbrains-license-server" \
@@ -23,7 +38,9 @@ LABEL maintainer="CrazyMax" \
ENV JLS_PATH="/opt/jetbrains-license-server" \
JLS_VERSION="21137" \
JLS_SHA256="05241f0d41644ecc7679a879c829e57d423e151b997b45c5e986d498d6fe2f21" \
TZ="UTC"
TZ="UTC" \
PUID="1000" \
PGID="1000"
RUN apt-get update \
&& apt-get install -y \
@@ -38,17 +55,16 @@ RUN apt-get update \
&& rm -f "/tmp/jls.zip" \
&& chmod a+x "$JLS_PATH/bin/license-server.sh" \
&& ln -sf "$JLS_PATH/bin/license-server.sh" "/usr/local/bin/license-server" \
&& groupadd -f -g 1000 jls \
&& useradd -o -s /bin/bash -d /data -u 1000 -g 1000 -m jls \
&& groupadd -f -g ${PGID} jls \
&& useradd -o -s /bin/bash -d /data -u ${PUID} -g jls -m jls \
&& chown -R jls. /data "$JLS_PATH" \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
COPY --from=suexec /usr/local/bin/su-exec /usr/local/bin/su-exec
COPY entrypoint.sh /entrypoint.sh
RUN chmod a+x /entrypoint.sh
USER jls
EXPOSE 8000
WORKDIR /data
VOLUME [ "/data" ]