0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-23 23:18:48 -05:00

Make backend docker image run on non-root user

This commit is contained in:
Andrey Antukh 2022-12-22 15:15:06 +01:00
parent 6cd6946c46
commit e4066e7f44

View file

@ -1,9 +1,18 @@
FROM ubuntu:22.04 as jre-build
ENV DEBIAN_FRONTEND=noninteractive \
TZ=Etc/UTC
RUN set -eux; \
apt-get -qq update; \
apt-get -qqy --no-install-recommends install curl ca-certificates binutils; \
rm -rf /var/lib/apt/lists/*; \
apt-get -qqy --no-install-recommends install \
curl \
ca-certificates \
binutils \
; \
rm -rf /var/lib/apt/lists/*;
RUN set -eux; \
ARCH="$(dpkg --print-architecture)"; \
case "${ARCH}" in \
aarch64|arm64) \
@ -42,13 +51,18 @@ RUN /opt/jdk/bin/jlink \
FROM ubuntu:22.04
LABEL maintainer="Andrey Antukh <niwi@niwi.nz>"
ENV LANG='en_US.UTF-8' LC_ALL='en_US.UTF-8' JAVA_HOME="/opt/jre" PATH="${JAVA_HOME}/bin:${PATH}"
WORKDIR /root
ENV LANG='en_US.UTF-8' \
LC_ALL='en_US.UTF-8' \
JAVA_HOME="/opt/jre" \
PATH=/opt/jre/bin:$PATH \
TZ=Etc/UTC
COPY --from=jre-build /opt/jre /opt/jre
RUN set -ex; \
useradd -U -M -u 1001 -s /bin/false -d /opt/penpot penpot; \
apt-get -qq update; \
apt-get -qqy --no-install-recommends install \
curl \
@ -66,6 +80,8 @@ RUN set -ex; \
locale-gen; \
rm -rf /var/lib/apt/lists/*;
ADD ./bundle-backend/ /opt/penpot/backend/
COPY --chown=penpot:penpot ./bundle-backend/ /opt/penpot/backend/
USER penpot:penpot
WORKDIR /opt/penpot/backend
CMD ["/bin/bash", "run.sh"]