Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TMP: Run as not-root #5694

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
FROM maven:3.9.7-eclipse-temurin-21-alpine@sha256:8b762a139e07e874e3830521d97bafaf963cce6bda92afe9fb532def5d011404 AS builder

RUN ["adduser", "-D", "build"]
USER build

WORKDIR /home/build
COPY . .
COPY --chown=build . .

RUN ["mvn", "clean", "--no-transfer-progress", "package", "-DskipTests"]

Expand All @@ -12,7 +15,7 @@ RUN ["apk", "--no-cache", "upgrade"]
ARG DNS_TTL=15

# Default to UTF-8 file.encoding
ENV LANG C.UTF-8
ENV LANG=C.UTF-8

RUN echo networkaddress.cache.ttl=$DNS_TTL >> "$JAVA_HOME/conf/security/java.security"

Expand All @@ -21,17 +24,20 @@ RUN /import_aws_rds_cert_bundles.sh && rm /import_aws_rds_cert_bundles.sh

RUN ["apk", "add", "--no-cache", "bash", "tini"]

ENV PORT 8080
ENV ADMIN_PORT 8081
RUN ["adduser", "--system", "pay"]
USER pay

ENV PORT=8080
ENV ADMIN_PORT=8081

EXPOSE 8080
EXPOSE 8081

WORKDIR /app

COPY --from=builder /home/build/docker-startup.sh .
COPY --from=builder /home/build/target/*.yaml .
COPY --from=builder /home/build/target/pay-*-allinone.jar .
COPY --from=builder --chown=pay /home/build/docker-startup.sh .
COPY --from=builder --chown=pay /home/build/target/*.yaml .
COPY --from=builder --chown=pay /home/build/target/pay-*-allinone.jar .

ENTRYPOINT ["tini", "-e", "143", "--"]

Expand Down
Loading