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

feat: set puppet uid/gid in container build #125

Merged
merged 2 commits into from
Sep 27, 2024
Merged
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
12 changes: 9 additions & 3 deletions puppetserver/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ARG UBUNTU_CODENAME=jammy
# base
######################################################

FROM ubuntu:22.04 as base
FROM ubuntu:22.04 AS base

ARG PACKAGES="ca-certificates git netbase openjdk-17-jre-headless ruby3.0 openssh-client"
ARG BUILD_PKGS="ruby3.0-dev gcc make cmake pkg-config libssl-dev libc6-dev"
Expand Down Expand Up @@ -91,19 +91,21 @@ RUN chmod +x /docker-entrypoint.sh /healthcheck.sh /docker-entrypoint.d/*.sh &&
# release (build from packages)
######################################################

FROM base as release
FROM base AS release

ARG PUPPET_RELEASE=8
ARG PUPPETSERVER_VERSION=8.6.1
ARG UBUNTU_CODENAME
ARG PUPPET_USER_UID=999
rwaffen marked this conversation as resolved.
Show resolved Hide resolved
ARG PUPPET_USER_GID=999

######################################################
# final image
######################################################

# dynamically selects "edge" or "release" alias based on ARG
# hadolint ignore=DL3006
FROM ${build_type} as final
FROM ${build_type} AS final

ARG vcs_ref
ARG build_type
Expand All @@ -112,6 +114,10 @@ ARG build_date
ENV PUPPET_DEB=puppet${PUPPET_RELEASE}-release-${UBUNTU_CODENAME}.deb
ADD https://apt.puppet.com/${PUPPET_DEB} /${PUPPET_DEB}

# Create puppet user and group with PUPPET_USER_UID and PUPPET_USER_GID
RUN groupadd -g ${PUPPET_USER_GID} puppet && \
useradd -m -u ${PUPPET_USER_UID} -g puppet puppet

# hadolint ignore=DL3008,DL3028
RUN dpkg -i /${PUPPET_DEB} && \
rm /${PUPPET_DEB}
Expand Down
Loading