Skip to content

Commit

Permalink
add node/npm to docker
Browse files Browse the repository at this point in the history
  • Loading branch information
pscheit committed Mar 8, 2024
1 parent 4303b3e commit f0e9c0e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ These steps are provided for development purposes only.
### Requirements

- **PHP** for the web app
- **NPM** for the frontend build
- **NPM** (or Docker) for the frontend build
- **[Symfony CLI](https://symfony.com/download)** to run the web server
- **MySQL** (or Docker) for the main data store
- **Redis** (or Docker) for some functionality (favorites, download statistics)
Expand All @@ -39,8 +39,9 @@ These steps are provided for development purposes only.
```
4. Start MySQL & Redis:
```bash
docker-compose up -d # or somehow run MySQL & Redis on localhost without docker
docker compose up -d # or somehow run MySQL & Redis on localhost without Docker
```
This mounts the current working directory into the node container and runs npm install and npm run build automatically.
5. Create 2 databases:
- `packagist` - for the web app
- `packagist_test` - for running the tests
Expand All @@ -53,7 +54,7 @@ These steps are provided for development purposes only.
bin/console doctrine:schema:create
```
7. Run a CRON job `bin/console packagist:run-workers` to make sure packages update.
8. Run `npm run build` or `npm run dev` to build (or build&watch) css/js files.
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.

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

Expand Down
12 changes: 7 additions & 5 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3'

services:
database:
image: mysql:8.0
Expand All @@ -9,12 +7,16 @@ services:
MYSQL_ALLOW_EMPTY_PASSWORD: 1
MYSQL_DATABASE: packagist
volumes:
- data:/var/lib/mysql
- /var/lib/mysql

redis:
image: redis:6.2-alpine
ports:
- 6379:6379

volumes:
data:
node:
image: 'node:20-alpine'
command: ['sh', '-c', 'npm install && npm run build']
working_dir: '/app'
volumes:
- .:/app

0 comments on commit f0e9c0e

Please sign in to comment.