Skip to content

Commit 99f7432

Browse files
committed
Improve on user privilege management
Instead of creating an image with the user just run the container with the flag --user
1 parent 426d605 commit 99f7432

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

docker-compose.yml

+2-4
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@ services:
1515
- wp_server
1616

1717
wp_server:
18-
build:
19-
context: ./docker-images/php/
20-
args:
21-
UID: ${UID}
18+
build: ./docker-images/php/
19+
user: ${UID}:www-data
2220
container_name: wp_server
2321
volumes:
2422
- ./www/wp_files/:/www

docker-images/php/Dockerfile

+1-7
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,11 @@ wp --allow-root --version
7474
# Maybe on the command gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$WORDPRESS_CLI_GPG_KEY"; \ you will
7575
# have an error, an issue opened in https://github.com/asdf-vm/asdf-nodejs/issues/38#issuecomment-298686787 suggest
7676
# that use hkp://ipv4.pool.sks-keyservers.net:80 instead of ha.pool.sks-keyservers.net
77-
# NOT TESTED
7877

7978
# Install mysql client
8079
RUN apk update \
8180
apk add mysql-client
8281

8382
WORKDIR /www
8483

85-
ENV PAGER more
86-
87-
ARG UID
88-
89-
RUN adduser -D -u "$UID" same_as_host -G www-data
90-
USER same_as_host
84+
ENV PAGER more

0 commit comments

Comments
 (0)