Skip to content

Commit d94f2c1

Browse files
qschmickTom Schlick
andauthored
PHP 8 Support (#15)
* Updated composer.json to require 7.3 or 8.0; Added docker * Updated CI to test in 8.0 * export-ignore /docker Co-authored-by: Tom Schlick <tom.schlick@pricespider.com>
1 parent 2ff67eb commit d94f2c1

File tree

6 files changed

+65
-2
lines changed

6 files changed

+65
-2
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@
1111
/tests export-ignore
1212
/.editorconfig export-ignore
1313
/.github export-ignore
14+
/docker export-ignore

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
strategy:
1212
fail-fast: true
1313
matrix:
14-
php: [7.3, 7.4]
14+
php: [7.3, 7.4, 8.0]
1515
stability: [prefer-lowest, prefer-stable]
1616

1717
name: PHP ${{ matrix.php }} - ${{ matrix.stability }}

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,25 @@ Both models must use the AuditLoggable trait (ex: Post and Tag) so that `$post->
165165
composer test
166166
```
167167

168+
### Using Docker
169+
All assets are set up under the docker-compose.yml file. The first time you run the docker image you must build it with
170+
the following command:
171+
```bash
172+
docker-compose build
173+
```
174+
175+
Then you can bring it up in the background using:
176+
```bash
177+
docker-compose up -d
178+
```
179+
180+
And the image is aliased so you can access its command line via:
181+
```bash
182+
docker exec -it processes-stamp-app /bin/bash
183+
```
184+
185+
From there you can run the tests within an isolated environment
186+
168187
## Contributing
169188

170189
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
}
2424
],
2525
"require": {
26-
"php": "^7.3",
26+
"php": "^7.3|^8.0",
2727
"awobaz/compoships": "^2.0.3",
2828
"fico7489/laravel-pivot": "^3.0.1",
2929
"laravel/framework": "^8.0",

docker-compose.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: "3.7"
2+
services:
3+
app:
4+
build:
5+
context: ./
6+
dockerfile: ./docker/Dockerfile
7+
image: auditlog
8+
container_name: auditlog-app
9+
restart: unless-stopped
10+
working_dir: /var/www/
11+
volumes:
12+
- ./:/var/www

docker/Dockerfile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
FROM php:8.0-fpm
2+
3+
# Install system dependencies
4+
RUN apt-get update && apt-get install -y \
5+
git \
6+
curl \
7+
libpng-dev \
8+
libonig-dev \
9+
libxml2-dev \
10+
libzip-dev \
11+
zip \
12+
unzip
13+
14+
# Clear cache
15+
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
16+
17+
# Install PHP extensions
18+
RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd zip
19+
20+
# Get latest Composer
21+
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
22+
23+
# Create system user to run Composer and Artisan Commands
24+
RUN useradd -G www-data,root -d /home/ubuntu ubuntu
25+
RUN mkdir -p /home/ubuntu/.composer && \
26+
chown -R ubuntu:ubuntu /home/ubuntu
27+
28+
# Set working directory
29+
WORKDIR /var/www
30+
31+
USER ubuntu

0 commit comments

Comments
 (0)