Skip to content

Commit 58f586c

Browse files
feat(docker): support docker using laravel sail
1 parent bb684d1 commit 58f586c

File tree

2 files changed

+66
-4
lines changed

2 files changed

+66
-4
lines changed

Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM node:lts-alpine3.14
2+
3+
RUN mkdir /app
4+
5+
COPY package*.json /app
6+
7+
WORKDIR /app
8+
9+
RUN npm i --legacy-peer-deps
10+
11+
COPY . .
12+
13+
EXPOSE 5173
14+
15+
CMD ["npm", "run", "dev", "--", "--host", "0.0.0.0"]

README.md

Lines changed: 51 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,60 @@ Install the dependencies and run the project using:
3838
npm i && npm run dev
3939
```
4040

41-
## Broadcasting Directory
41+
### Docker
4242

43-
This project has a server-side part please take a look at the next section
43+
To work with Docker please navigate to the [backend project](https://github.com/themustafaomar/vue-starter-server) and run the following command:
4444

45-
As for broadcasting we're using the offical reverb websocket section.
45+
```bash
46+
./vendor/bin/sail up --build
47+
```
48+
49+
You can call sail directly if you have it installed globally with the following command, more information about sail please visit the offical [documentation](https://laravel.com/docs/10.x/sail).
50+
51+
```bash
52+
sail up --build
53+
```
54+
55+
This will run the frontend and the backend without doing anything, you'll just need to run the migrations:
56+
57+
```bash
58+
sail artisan migrate --seed
59+
```
60+
61+
#### Broadcasting
62+
63+
As for broadcasting we're using the offical Reverb websocket server, for more information about Reverb please visit the offical documentation: https://laravel.com/docs/10.x/reverb
4664

47-
For more information about Reverb please visit the offical website: https://laravel.com/docs/reverb
65+
Once you run `sail up` in your terminal the websocket server will run automatically using supervisor which I already done it for you, it's configured in ./docker/8.3/supervisord.conf this is what it looks like:
66+
67+
```conf
68+
[program:reverb]
69+
command=php /var/www/html/artisan reverb:start --host="0.0.0.0" --port=8080
70+
autostart=true
71+
autorestart=true
72+
user=%(ENV_SUPERVISOR_PHP_USER)s
73+
redirect_stderr=true
74+
stdout_logfile=/var/www/html/storage/logs/reverb.log
75+
```
76+
77+
#### Queues
78+
79+
I chose not to add laravel worker configuration for you, I prefer running the following command each time because I need to restart the queues a lot, however this is the supervisor worker configuration.
80+
81+
```conf
82+
[program:laravel-worker]
83+
process_name=%(program_name)s_%(process_num)02d
84+
command=php /var/www/html/artisan queue:work --sleep=3 --tries=3 --max-time=3600
85+
autostart=true
86+
autorestart=true
87+
stopasgroup=true
88+
killasgroup=true
89+
user=sail
90+
numprocs=1
91+
redirect_stderr=true
92+
stdout_logfile=/var/www/html/storage/logs/worker.log
93+
stopwaitsecs=3600
94+
```
4895

4996
## Server Side
5097

0 commit comments

Comments
 (0)