@@ -148,6 +148,7 @@ ARG XDEBUG_VERSION=3.5.1
148148# Latest version of pcov: https://packagist.org/packages/pecl/pcov
149149ARG PCOV_VERSION=1.0.12
150150
151+
151152RUN apt-get update \
152153 && apt-get install --assume-yes --no-install-recommends \
153154 # Needed for xdebug extension configuration
@@ -185,6 +186,50 @@ RUN apt-get update \
185186 && rm -rf /var/lib/apt/lists/* \
186187 && rm -rf /tmp/*
187188
189+ # Latest version of fixuid: https://github.com/boxboat/fixuid/releases/latest
190+ ARG FIXUID_VERSION=0.6.0
191+
192+ ARG USER=code
193+ ARG GROUP=code
194+ ARG USER_UID=1000
195+ ARG USER_GID=1000
196+ ARG TARGETARCH
197+
198+ SHELL ["/bin/bash" , "-o" , "pipefail" , "-c" ]
199+
200+ RUN curl -fsSLo /tmp/fixuid.tar.gz "https://github.com/boxboat/fixuid/releases/download/v$FIXUID_VERSION/fixuid-${FIXUID_VERSION}-linux-${TARGETARCH}.tar.gz" \
201+ && tar -xf /tmp/fixuid.tar.gz -C /usr/local/bin fixuid \
202+ && chown root:root /usr/local/bin/fixuid \
203+ && chmod 4755 /usr/local/bin/fixuid \
204+ && rm /tmp/fixuid.tar.gz \
205+ # Create user and group, and setup fixuid configuration
206+ && existing_group="$(getent group " $USER_GID" | cut -d: -f1 || true)" \
207+ && if [ -z "$existing_group" ]; then \
208+ groupadd --gid "$USER_GID" "$GROUP" ; \
209+ existing_group="$GROUP" ; \
210+ fi \
211+ && useradd --uid "$USER_UID" --gid "$USER_GID" --create-home "$USER" --shell /bin/bash \
212+ && mkdir -p \
213+ /etc/fixuid \
214+ "/data" \
215+ "/config" \
216+ "/cache" \
217+ && chown -R "$USER_UID" :"$USER_GID" \
218+ "/data" \
219+ "/config" \
220+ "/cache" \
221+ && cat <<EOF > /etc/fixuid/config.yml
222+ user: $USER
223+ group: $existing_group
224+ paths:
225+ - /var/www
226+ - /home/$USER
227+ - /data
228+ - /config
229+ - /cache
230+
231+ EOF
232+
188233FROM builder AS builder_nodejs
189234
190235ARG TARGETARCH
0 commit comments