Skip to content

Commit 426d605

Browse files
committed
Much better user privilege management.
Now, we are able to modify the wp files inside and outside the container, even when the container creates its own.
1 parent 130f6eb commit 426d605

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,30 @@
11
# Dev environment WordPress with Docker _**TIPS**_
22

33

4-
#### This docker compose was made to have a modern WP dev environment which can be portable, easy to set up and focused on the use of `wp-cli`.
4+
#### This docker compose was made to have a modern WP dev environment which can be portable, easy to set up and focused on the use of `wp`.
55

66
> With `docker-compose up` it will run a phpmyadmin service, this is created with goal of facilitate the management of the DataBase (not all of us are command ninja) so we recommend, stop it when you are not using it.
77
> `docker-compose stop wp_phpmyadmin`
88
9+
## Start everything
10+
11+
For be able to manipulate easily the files of wordpress you need to:
12+
13+
`export UID && docker-compose up`
14+
915
## Steps to begin with a new WP project
1016

1117
1. Create the user using phpmyadmin
1218
- Set as `Host name` **=** `Use text field`= `wp_server`
13-
2. Download the WordPress core using `docker exec wp_server wp-cli core download`
14-
3. Create your `wp-config` file `docker exec -ti wp_server wp-cli core config --prompt`
19+
2. Download the WordPress core using `docker exec wp_server wp core download`
20+
3. Create your `wp-config` file `docker exec -ti wp_server wp core config --prompt`
1521
- 1/12 --dbname=<**dbname**>: `YOUR_DB_NAME`
1622
- 2/12 --dbuser=<**dbuser**>: `USER_CREATED_AT_1`
1723
- 3/12 [--dbpass=<**dbpass**>]: `PASS_CREATED_AT_1`
1824
- 4/12 [--dbhost=<**dbhost**>]: `wp_mariadb`
1925
- 5...12 - Default values set by enter
20-
4. Create db `docker exec -ti wp_server wp-cli db create`
21-
5. Install WordPress site `docker exec -ti wp_server wp-cli core install --prompt`
26+
4. Create db `docker exec -ti wp_server wp db create`
27+
5. Install WordPress site `docker exec -ti wp_server wp core install --prompt`
2228
- 1/6 --url=<**url**>: `localhost`
2329
- 2...6 - Your personal configuration
2430

docker-compose.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ services:
1515
- wp_server
1616

1717
wp_server:
18-
# image: dianjuar/wordpress:php7.1-fpm-alphine_wp-cli1.3.0
19-
build: ./docker-images/php/
18+
build:
19+
context: ./docker-images/php/
20+
args:
21+
UID: ${UID}
2022
container_name: wp_server
2123
volumes:
2224
- ./www/wp_files/:/www

docker-images/php/Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ WORKDIR /www
8484

8585
ENV PAGER more
8686

87-
# Creating an "alias" to not run the wp command with the anoying --allow-root flag each time
88-
RUN echo "#!/bin/bash" > /usr/bin/wp-cli
89-
RUN echo "wp \"\$@\" --allow-root" >> /usr/bin/wp-cli
90-
RUN chmod +x /usr/bin/wp-cli
87+
ARG UID
88+
89+
RUN adduser -D -u "$UID" same_as_host -G www-data
90+
USER same_as_host

0 commit comments

Comments
 (0)