File tree 3 files changed +24
-12
lines changed
3 files changed +24
-12
lines changed Original file line number Diff line number Diff line change 23
23
! bin /console
24
24
docker /db /data /
25
25
helm /
26
+ node_modules /
26
27
public /bundles /
27
28
var /
28
29
vendor /
29
- node_modules /
Original file line number Diff line number Diff line change @@ -29,10 +29,10 @@ A [Docker](https://www.docker.com/)-based installer and runtime for the [Symfony
29
29
1 . [ Build options] ( docs/build.md )
30
30
2 . [ Using Symfony Docker with an existing project] ( docs/existing-project.md )
31
31
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 )
36
36
8 . [ Troubleshooting] ( docs/troubleshooting.md )
37
37
38
38
## Credits
Original file line number Diff line number Diff line change 1
1
# Building CSS and JS
2
2
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.
4
5
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 ) . *
6
7
8
+ Modify ` Dockerfile ` to build your assets :
9
+
10
+ - At the top of the file before anything else
7
11
``` diff
12
+ ARG PHP_VERSION=8.1
8
13
ARG CADDY_VERSION=2
9
- + ARG NODE_VERSION=17
10
-
14
+ + ARG NODE_VERSION=18
15
+ +
16
+ + # node "stage"
11
17
+ FROM node:${NODE_VERSION}-alpine AS symfony_node
18
+ +
12
19
+ WORKDIR /srv/app
20
+ +
13
21
+ COPY package*.json ./
22
+ +
14
23
+ RUN npm install
15
24
+ ## If you are building your code for production
16
25
+ # RUN npm ci --only=production
26
+ +
27
+ + ## You need to copy everything to use PostCSS, Tailwinds, ...
17
28
+ COPY . .
29
+ +
18
30
+ RUN npm run build
19
31
20
32
# "php" stage
21
33
```
22
34
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 ` ).
24
36
25
37
``` diff
26
38
VOLUME /srv/app/var
@@ -47,12 +59,12 @@ This will provide you with hot module reloading.
47
59
+ context: .
48
60
+ target: symfony_node
49
61
+ volumes:
50
- + - ./:/srv/app:rw,cached
62
+ + - ./:/srv/app
51
63
+ ports:
52
64
+ - target: 8080
53
65
+ published: 8080
54
66
+ 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"'
56
68
```
57
69
58
70
If file changes are not picked up, refer to this page:
You can’t perform that action at this time.
0 commit comments