Skip to content

Commit 799b11a

Browse files
committed
move user and directory ownership
1 parent bb070fe commit 799b11a

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

Dockerfile

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,20 @@ COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
1414
RUN composer install --working-dir=/app --no-dev --prefer-dist \
1515
&& rm /usr/local/bin/composer
1616

17+
# Create a custom user with UID 1234 and GID 1234
18+
RUN groupadd -g 1234 pubsubgroup && \
19+
useradd -m -u 1234 -g pubsubgroup pubsubuser
20+
21+
RUN chown -R 1234:1234 /app/server/
22+
USER pubsubuser
1723
WORKDIR /app/server/certs
24+
1825
RUN openssl genrsa -des3 -passout pass:x -out server.pass.key 2048 && \
1926
openssl rsa -passin pass:x -in server.pass.key -out server.key && \
2027
rm server.pass.key && \
2128
openssl req -new -key server.key -out server.csr -subj "/C=NL/ST=Overijssel/L=Enschede/O=PDSInterop/OU=PDSInterop/CN=pubsub" && \
2229
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
2330

24-
# Create a custom user with UID 1234 and GID 1234
25-
RUN groupadd -g 1234 pubsubgroup && \
26-
useradd -m -u 1234 -g pubsubgroup pubsubuser
27-
28-
USER pubsubuser
29-
3031
WORKDIR /app/server/
3132
EXPOSE 8080
3233
CMD ["php", "server.php"]

0 commit comments

Comments
 (0)