Skip to content

Commit b385005

Browse files
authored
Merge pull request #78 from jkaninda/develop
Update PHP and Node version
2 parents 23bd4ca + b7ed2ad commit b385005

File tree

5 files changed

+44
-13
lines changed

5 files changed

+44
-13
lines changed

.github/workflows/integration-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: Run docker-compose
1515
run:
1616
cp ./tests/compose.yaml compose.yaml &&
17-
docker-compose -f "compose.yaml" up -d
17+
docker compose -f "compose.yaml" up -d
1818
- name: Create script.js for K6 test
1919
run: |
2020
touch script.js && cat > script.js <<EOF

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
IMAGE_NAME:jkaninda/laravel-php-fpm
2+
build-8.1:
3+
docker buildx build -f src/docker/8.1/Dockerfile -t ${IMAGE_NAME}:8.1 .
4+
build-8.2:
5+
docker buildx build -f src/docker/8.2/Dockerfile -t ${IMAGE_NAME}:8.2 .
6+
build-8.3:
7+
docker buildx build -f src/docker/8.3/Dockerfile -t ${IMAGE_NAME}:8.3 .

README.md

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,39 @@ services:
6262
user: www-data #Use www-data user for production usage
6363
volumes:
6464
#Project root
65-
- ./:/var/www/html
65+
- ./src:/var/www/html
6666
networks:
6767
- default #if you're using networks between containers
6868

6969
```
70-
## Laravel `artisan` command usage:
71-
### Open php-fpm
70+
## Docker:
71+
### Run
72+
```sh
73+
docker compose up -d
74+
```
75+
### Create Laravel project
76+
```sh
77+
docker compose exec php-fpm composer create-project --prefer-dist laravel/laravel .
78+
```
79+
### Artisan generate key
80+
```sh
81+
docker compose exec php-fpm php artisan key:generate
82+
```
83+
### Storage link
7284
```sh
73-
docker compose exec php-fpm /bin/bash
85+
docker compose exec php-fpm php artisan storage:link
86+
```
87+
### Fix permissions
88+
```sh
89+
docker compose exec php-fpm chmod -R 777 storage bootstrap/cache
90+
```
91+
### Laravel migration
92+
```sh
93+
docker compose exec php-fpm php artisan migrate
94+
```
95+
###
96+
```sh
97+
docker exec -it php-fpm bash
7498

7599
```
76100

@@ -82,7 +106,6 @@ docker compose exec php-fpm /bin/bash
82106
## Example Laravel-php-fpm with nginx:
83107
### docker-compose.yml
84108
```yml
85-
version: '3'
86109
services:
87110
php-fpm:
88111
image: jkaninda/laravel-php-fpm
@@ -151,7 +174,6 @@ server {
151174
## Advanced Laravel-php-fpm with nginx:
152175
### docker-compose.yml
153176
```yml
154-
version: '3'
155177
services:
156178
php-fpm:
157179
image: jkaninda/laravel-php-fpm
@@ -183,7 +205,7 @@ volumes:
183205
184206
## Docker run
185207
```sh
186-
docker-compose up -d
208+
docker compose up -d
187209

188210
```
189211
## Build from base

src/docker/8.1/Dockerfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM php:8.1-fpm
22
ARG WORKDIR=/var/www/html
33
ENV DOCUMENT_ROOT=${WORKDIR}
44
ENV LARAVEL_PROCS_NUMBER=1
5-
ENV NODE_VERSION=17.x
5+
ENV NODE_MAJOR=20
66
ARG GROUP_ID=1000
77
ARG USER_ID=1000
88
ENV USER_NAME=www-data
@@ -28,9 +28,11 @@ RUN apt-get update && apt-get install -y \
2828
nano \
2929
cron
3030

31-
RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION} | bash -
32-
# Install Node
33-
RUN apt-get install -y nodejs
31+
# Install Nodejs
32+
RUN apt-get update && apt-get install -y ca-certificates curl gnupg
33+
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
34+
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
35+
RUN apt-get update && apt-get install nodejs -y
3436

3537
# Clear cache
3638
RUN apt-get clean && rm -rf /var/lib/apt/lists/*

src/docker/8.3/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM php:8.3.3-fpm
1+
FROM php:8.3.4-fpm
22
ARG WORKDIR=/var/www/html
33
ENV DOCUMENT_ROOT=${WORKDIR}
44
ENV LARAVEL_PROCS_NUMBER=1

0 commit comments

Comments
 (0)