Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add node/npm to compose file #1432

Merged
merged 3 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
pscheit marked this conversation as resolved.
Show resolved Hide resolved

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

Expand Down
7 changes: 7 additions & 0 deletions docker-compose.node.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
services:
node:
image: 'node:20-alpine'
command: ['sh', '-c', 'npm install && npm run build']
working_dir: '/app'
volumes:
- .:/app
7 changes: 1 addition & 6 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,9 @@ 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:
Loading