Skip to content

Commit 8736822

Browse files
authored
Add node/npm to compose file (#1432)
1 parent 62fc908 commit 8736822

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

Diff for: README.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ These steps are provided for development purposes only.
1919
### Requirements
2020

2121
- **PHP** for the web app
22-
- **NPM** for the frontend build
22+
- **NPM** (or Docker) for the frontend build
2323
- **[Symfony CLI](https://symfony.com/download)** to run the web server
2424
- **MySQL** (or Docker) for the main data store
2525
- **Redis** (or Docker) for some functionality (favorites, download statistics)
@@ -39,8 +39,9 @@ These steps are provided for development purposes only.
3939
```
4040
4. Start MySQL & Redis:
4141
```bash
42-
docker compose up -d # or somehow run MySQL & Redis on localhost without docker
42+
docker compose up -d # or somehow run MySQL & Redis on localhost without Docker
4343
```
44+
This mounts the current working directory into the node container and runs npm install and npm run build automatically.
4445
5. Create 2 databases:
4546
- `packagist` - for the web app
4647
- `packagist_test` - for running the tests
@@ -53,7 +54,7 @@ These steps are provided for development purposes only.
5354
bin/console doctrine:schema:create
5455
```
5556
7. Run a CRON job `bin/console packagist:run-workers` to make sure packages update.
56-
8. Run `npm run build` or `npm run dev` to build (or build&watch) css/js files.
57+
8. Run `npm run build` or `npm run dev` to build (or build&watch) css/js files. When using Docker run `docker compose run node npm run dev` to watch css/js files.
5758

5859
You should now be able to access the site, create a user, etc.
5960

Diff for: docker-compose.node.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
services:
2+
node:
3+
image: 'node:20-alpine'
4+
command: ['sh', '-c', 'npm install && npm run build']
5+
working_dir: '/app'
6+
volumes:
7+
- .:/app

Diff for: docker-compose.yaml

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: '3'
2-
31
services:
42
database:
53
image: mysql:8.0
@@ -9,12 +7,9 @@ services:
97
MYSQL_ALLOW_EMPTY_PASSWORD: 1
108
MYSQL_DATABASE: packagist
119
volumes:
12-
- data:/var/lib/mysql
10+
- /var/lib/mysql
1311

1412
redis:
1513
image: redis:6.2-alpine
1614
ports:
1715
- 6379:6379
18-
19-
volumes:
20-
data:

0 commit comments

Comments
 (0)