Skip to content

Commit e2c2e08

Browse files
committed
Rework
1 parent 5d8afbb commit e2c2e08

File tree

3 files changed

+24
-12
lines changed

3 files changed

+24
-12
lines changed

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ bin/*
2323
!bin/console
2424
docker/db/data/
2525
helm/
26+
node_modules/
2627
public/bundles/
2728
var/
2829
vendor/
29-
node_modules/

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ A [Docker](https://www.docker.com/)-based installer and runtime for the [Symfony
2929
1. [Build options](docs/build.md)
3030
2. [Using Symfony Docker with an existing project](docs/existing-project.md)
3131
3. [Support for extra services](docs/extra-services.md)
32-
4. [Deploying in production](docs/production.md)
33-
5. [Installing Xdebug](docs/xdebug.md)
34-
6. [Using a Makefile](docs/makefile.md)
35-
7. [Building CSS and JS](docs/build-css-js.md)
32+
4. [Building CSS and JS](docs/build-css-js.md)
33+
5. [Deploying in production](docs/production.md)
34+
6. [Installing Xdebug](docs/xdebug.md)
35+
7. [Using a Makefile](docs/makefile.md)
3636
8. [Troubleshooting](docs/troubleshooting.md)
3737

3838
## Credits

docs/build-css-js.md

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,38 @@
11
# Building CSS and JS
22

3-
This example uses `npm` and [Webpack Encore](https://symfony.com/doc/current/frontend.html).
3+
For security reason and limit the size of the container, the default stack doesn't include any development "artifacts".
4+
To add it to the project and your development workflow follow this guide.
45

5-
Modify `Dockerfile` to build your assets before anything else.
6+
*This example uses `npm` and [Webpack Encore](https://symfony.com/doc/current/frontend.html).*
67

8+
Modify `Dockerfile` to build your assets :
9+
10+
- At the top of the file before anything else
711
```diff
12+
ARG PHP_VERSION=8.1
813
ARG CADDY_VERSION=2
9-
+ARG NODE_VERSION=17
10-
14+
+ARG NODE_VERSION=18
15+
+
16+
+# node "stage"
1117
+FROM node:${NODE_VERSION}-alpine AS symfony_node
18+
+
1219
+WORKDIR /srv/app
20+
+
1321
+COPY package*.json ./
22+
+
1423
+RUN npm install
1524
+## If you are building your code for production
1625
+# RUN npm ci --only=production
26+
+
27+
+## You need to copy everything to use PostCSS, Tailwinds, ...
1728
+COPY . .
29+
+
1830
+RUN npm run build
1931

2032
# "php" stage
2133
```
2234

23-
Then copy the built output in `public/build` (the configuration default) to the `php` container (which will then be copied later to `caddy`).
35+
- Then copy the built output in `public/build` (the configuration default) to the `php` container (which will then be copied later to `caddy`).
2436

2537
```diff
2638
VOLUME /srv/app/var
@@ -47,12 +59,12 @@ This will provide you with hot module reloading.
4759
+ context: .
4860
+ target: symfony_node
4961
+ volumes:
50-
+ - ./:/srv/app:rw,cached
62+
+ - ./:/srv/app
5163
+ ports:
5264
+ - target: 8080
5365
+ published: 8080
5466
+ protocol: tcp
55-
+ command: 'sh -c "npm install; npm run dev-server -- --client-web-socket-url https://localhost:8080 --host 0.0.0.0"'
67+
+ command: 'sh -c "npm install; npm run dev-server -- --server-type https --client-web-socket-url https://localhost:8080 --host 0.0.0.0"'
5668
```
5769

5870
If file changes are not picked up, refer to this page:

0 commit comments

Comments
 (0)