Skip to content

Commit

Permalink
Merge pull request #78 from jkaninda/develop
Browse files Browse the repository at this point in the history
Update PHP and Node version
  • Loading branch information
jkaninda authored Sep 18, 2024
2 parents 23bd4ca + b7ed2ad commit b385005
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Run docker-compose
run:
cp ./tests/compose.yaml compose.yaml &&
docker-compose -f "compose.yaml" up -d
docker compose -f "compose.yaml" up -d
- name: Create script.js for K6 test
run: |
touch script.js && cat > script.js <<EOF
Expand Down
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
IMAGE_NAME:jkaninda/laravel-php-fpm
build-8.1:
docker buildx build -f src/docker/8.1/Dockerfile -t ${IMAGE_NAME}:8.1 .
build-8.2:
docker buildx build -f src/docker/8.2/Dockerfile -t ${IMAGE_NAME}:8.2 .
build-8.3:
docker buildx build -f src/docker/8.3/Dockerfile -t ${IMAGE_NAME}:8.3 .
36 changes: 29 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,39 @@ services:
user: www-data #Use www-data user for production usage
volumes:
#Project root
- ./:/var/www/html
- ./src:/var/www/html
networks:
- default #if you're using networks between containers

```
## Laravel `artisan` command usage:
### Open php-fpm
## Docker:
### Run
```sh
docker compose up -d
```
### Create Laravel project
```sh
docker compose exec php-fpm composer create-project --prefer-dist laravel/laravel .
```
### Artisan generate key
```sh
docker compose exec php-fpm php artisan key:generate
```
### Storage link
```sh
docker compose exec php-fpm /bin/bash
docker compose exec php-fpm php artisan storage:link
```
### Fix permissions
```sh
docker compose exec php-fpm chmod -R 777 storage bootstrap/cache
```
### Laravel migration
```sh
docker compose exec php-fpm php artisan migrate
```
###
```sh
docker exec -it php-fpm bash

```

Expand All @@ -82,7 +106,6 @@ docker compose exec php-fpm /bin/bash
## Example Laravel-php-fpm with nginx:
### docker-compose.yml
```yml
version: '3'
services:
php-fpm:
image: jkaninda/laravel-php-fpm
Expand Down Expand Up @@ -151,7 +174,6 @@ server {
## Advanced Laravel-php-fpm with nginx:
### docker-compose.yml
```yml
version: '3'
services:
php-fpm:
image: jkaninda/laravel-php-fpm
Expand Down Expand Up @@ -183,7 +205,7 @@ volumes:
## Docker run
```sh
docker-compose up -d
docker compose up -d

```
## Build from base
Expand Down
10 changes: 6 additions & 4 deletions src/docker/8.1/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM php:8.1-fpm
ARG WORKDIR=/var/www/html
ENV DOCUMENT_ROOT=${WORKDIR}
ENV LARAVEL_PROCS_NUMBER=1
ENV NODE_VERSION=17.x
ENV NODE_MAJOR=20
ARG GROUP_ID=1000
ARG USER_ID=1000
ENV USER_NAME=www-data
Expand All @@ -28,9 +28,11 @@ RUN apt-get update && apt-get install -y \
nano \
cron

RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION} | bash -
# Install Node
RUN apt-get install -y nodejs
# Install Nodejs
RUN apt-get update && apt-get install -y ca-certificates curl gnupg
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
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
RUN apt-get update && apt-get install nodejs -y

# Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
Expand Down
2 changes: 1 addition & 1 deletion src/docker/8.3/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:8.3.3-fpm
FROM php:8.3.4-fpm
ARG WORKDIR=/var/www/html
ENV DOCUMENT_ROOT=${WORKDIR}
ENV LARAVEL_PROCS_NUMBER=1
Expand Down

0 comments on commit b385005

Please sign in to comment.