Skip to content

Commit

Permalink
Merge pull request #125 from vrtdev/feature/puppet_uid_gid
Browse files Browse the repository at this point in the history
feat: set puppet uid/gid in container build
  • Loading branch information
rwaffen authored Sep 27, 2024
2 parents 99649e8 + 9606402 commit b637b92
Showing 1 changed file with 9 additions and 3 deletions.
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
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

0 comments on commit b637b92

Please sign in to comment.