Skip to content

Commit 1d674fe

Browse files
Removed build containers from docker-compose.yml in favour of separate commands
1 parent d312d1f commit 1d674fe

4 files changed

Lines changed: 14 additions & 42 deletions

File tree

docker-compose-testdb.yml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -71,19 +71,6 @@ services:
7171
volumes:
7272
- userfrosting-test-db:/var/lib/mysql
7373

74-
composer:
75-
image: "composer"
76-
volumes:
77-
- .:/app
78-
working_dir: /app
79-
80-
node:
81-
build:
82-
context: ./docker/node
83-
volumes:
84-
- .:/app
85-
working_dir: /app/build
86-
8774
volumes:
8875
userfrosting-db:
8976
driver: local

docker-compose.yml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,6 @@ services:
4949
volumes:
5050
- userfrosting-db:/var/lib/mysql
5151

52-
composer:
53-
image: "composer"
54-
volumes:
55-
- .:/app
56-
working_dir: /app
57-
58-
node:
59-
build:
60-
context: ./docker/node
61-
volumes:
62-
- .:/app
63-
working_dir: /app/build
64-
6552
volumes:
6653
userfrosting-db:
6754
driver: local

docker/README.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,36 @@ Second, initialize a new UserFrosting project:
99
1. Copy `app/sprinkles.example.json` to `app/sprinkles.json`
1010
2. Run `chmod 777 app/{logs,cache,sessions}` to fix file permissions for web server. (NOTE: File
1111
permissions should be properly secured in a production environment!)
12-
3. Run `docker-compose run composer install --ignore-platform-reqs --no-scripts` to install all composer modules. (https://hub.docker.com/_/composer) Sometimes dependencies or Composer scripts require the availability of certain PHP extensions. You can work around this as follows: Pass the `--ignore-platform-reqs and --no-scripts` flags to install or update
13-
4. Run `docker-compose run node npm install` to install all npm modules.
14-
5. Run `docker-compose run composer update --ignore-platform-reqs --no-scripts` to install remaining composer modules
15-
6. Run `docker-compose run node npm run uf-assets-install` to install all frontend vendor assets.
12+
3. Run `docker run --rm -it --volume ${pwd}:/app composer install --ignore-platform-reqs --no-scripts` to install all composer modules. (https://hub.docker.com/_/composer) Sometimes dependencies or Composer scripts require the availability of certain PHP extensions. You can work around this as follows: Pass the `--ignore-platform-reqs and --no-scripts` flags to install or update
13+
4. Run `docker run --rm -it --volume ${pwd}:/app node:alpine /bin/sh -c "cd /app/build ; npm install; npm run uf-assets-install"` to install all npm modules and frontend vendor assets.
1614

1715
Now you can start up the entire Nginx + PHP + MySQL stack using docker with:
1816

19-
$ docker-compose up -d
17+
```bash
18+
$ docker-compose up -d
19+
```
2020

2121
the `-d` flag will launch this in the background so you can continue to use the terminal window. On the first run you need to init the database (your container name may be different depending on the name of your root directory):
2222

23-
$ docker exec -it -u www-data userfrosting_php_1 sh -c 'php bakery migrate'
23+
```bash
24+
$ docker exec -it -u www-data userfrosting_php_1 sh -c 'php bakery migrate'
25+
```
2426

2527
You also need to setup the first admin user (again, your container name may be different depending on the name of your root directory):
2628

27-
$ docker exec -it -u www-data userfrosting_php_1 sh -c 'php bakery create-admin'
29+
```bash
30+
$ docker exec -it -u www-data userfrosting_php_1 sh -c 'php bakery create-admin'
31+
```
2832

2933
Now visit `http://localhost:8591/` to see your UserFrosting homepage!
3034

3135
**Paste these into a bash file and execute it!**
3236

33-
```
37+
```bash
3438
chmod 777 app/{logs,cache,sessions}
3539
docker-compose build --force-rm --no-cache
36-
docker-compose run composer install --ignore-platform-reqs --no-scripts
37-
docker-compose run node npm install
38-
docker-compose run composer update --ignore-platform-reqs --no-scripts
39-
docker-compose run node npm run uf-assets-install
40+
docker run --rm -it --volume ${pwd}:/app composer update --ignore-platform-reqs --no-scripts
41+
docker run --rm -it --volume ${pwd}:/app node:alpine /bin/sh -c "cd /app/build ; npm install ; npm run uf-assets-install"
4042
docker-compose up -d
4143
echo -n "Enter Docker Container Name --> "
4244
read docker_container

docker/node/Dockerfile

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)