Skip to content

Commit e4dd0c0

Browse files
author
Daniel Mellum
committed
update the testing enviroment
1 parent a4813c3 commit e4dd0c0

File tree

12 files changed

+59
-145
lines changed

12 files changed

+59
-145
lines changed

.circleci/config.yml

Lines changed: 0 additions & 65 deletions
This file was deleted.

.circleci/php8/entrypoint.sh

Lines changed: 0 additions & 5 deletions
This file was deleted.

.github/workflows/docker.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: TestInDocker
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
docker:
13+
timeout-minutes: 15
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v1
19+
20+
- name: Start containers and Run tests
21+
run: docker-compose -f "docker-compose.yml" up -d --build
22+
23+
- name: Stop containers
24+
if: always()
25+
run: docker-compose -f "docker-compose.yml" down

buildDockerImages.sh

100644100755
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
#!/usr/bin/env bash
2-
echo "Building PHP7 image..." &&
3-
cd .circleci/php7 && docker build . -t danielme/laravel-circleci-php7:latest &&
42
echo "Building PHP8 image..." &&
5-
cd ../../.circleci/php8 && docker build . -t danielme/laravel-circleci-php8:latest
3+
cd ./docker/php8 && docker build . -t danielme/laravel-php8:latest

docker-compose.yaml

Lines changed: 8 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ services:
66
image: mariadb:10.5
77
container_name: laravel-log-to-db-mariadb
88
networks:
9-
- laravel-log-to-db-testbench
9+
- laravel-log-to-db-testing
1010
ports:
1111
- "3366:3306"
1212
environment:
@@ -17,47 +17,20 @@ services:
1717
image: mongo:latest
1818
container_name: laravel-log-to-db-mongodb
1919
networks:
20-
- laravel-log-to-db-testbench
20+
- laravel-log-to-db-testing
2121
ports:
2222
- "27888:27017"
2323

24-
php7:
25-
image: danielme/laravel-circleci-php7:latest
26-
container_name: laravel-log-to-db-php7_testbench
27-
depends_on:
28-
- "mariadb"
29-
- "mongo"
30-
networks:
31-
- laravel-log-to-db-testbench
32-
volumes:
33-
- .:/var/testing
34-
environment:
35-
- DB_CONNECTION=mysql
36-
- DB_HOST=mariadb
37-
- DB_PORT=3306
38-
- DB_DATABASE=logtodb
39-
- DB_USERNAME=root
40-
- MDB_DATABASE=logtodb
41-
- MDB_HOST=mongo
42-
- MDB_PORT=27017
43-
44-
#entrypoint: "tail -f /dev/null"
45-
46-
entrypoint: bash -c "
47-
cd /var/testing &&
48-
composer install --no-interaction &&
49-
dockerize -wait tcp://mariadb:3306 -timeout 1m &&
50-
./vendor/bin/testbench package:test
51-
"
52-
5324
php8:
54-
image: danielme/laravel-circleci-php8:latest
55-
container_name: laravel-log-to-db-php8_testbench
25+
container_name: laravel-log-to-db-php8
26+
build:
27+
context: ./docker/php8/
28+
dockerfile: Dockerfile
5629
depends_on:
5730
- "mariadb"
5831
- "mongo"
5932
networks:
60-
- laravel-log-to-db-testbench
33+
- laravel-log-to-db-testing
6134
volumes:
6235
- .:/var/testing
6336
environment:
@@ -70,8 +43,6 @@ services:
7043
- MDB_HOST=mongo
7144
- MDB_PORT=27017
7245

73-
#entrypoint: "tail -f /dev/null"
74-
7546
entrypoint: bash -c "
7647
cd /var/testing &&
7748
composer install --no-interaction &&
@@ -80,5 +51,5 @@ services:
8051
"
8152
8253
networks:
83-
laravel-log-to-db-testbench:
54+
laravel-log-to-db-testing:
8455
driver: bridge
Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,32 @@
1-
FROM alpine:latest
1+
FROM ubuntu:jammy
22

33
LABEL Maintainer="Daniel Mellum <mellum@gmail.com>" \
44
Description="A simple docker image used in phpunit testing Laravel apps."
55

66
ENV DOCKERIZE_VERSION v0.6.1
7+
ENV TZ=America/New_York
8+
ARG DEBIAN_FRONTEND=noninteractive
79

8-
RUN apk --no-cache add php7 php7-common php7-fpm php7-zip php7-json php7-openssl php7-curl \
9-
php7-zlib php7-xml php7-phar php7-intl php7-dom php7-xmlreader php7-xmlwriter php7-ctype \
10-
php7-mbstring php7-gd php7-session php7-pdo php7-pdo_mysql php7-tokenizer php7-posix \
11-
php7-fileinfo php7-opcache php7-cli php7-mcrypt php7-pcntl php7-iconv php7-simplexml php7-mongodb \
12-
curl git openssl openssh-client mysql-client bash
10+
WORKDIR /
11+
12+
RUN apt update && apt upgrade -y
13+
RUN apt install -y curl git openssl openssh-client mysql-client bash libzip-dev zip wget \
14+
php8.1 php8.1-dev php8.1-mysql php8.1-mongodb php8.1-curl php8.1-mbstring
15+
16+
RUN pecl install pcov
17+
RUN pecl install mongodb
18+
19+
#RUN mkdir -p /etc/php81/mods-available && echo "extension=mongodb.so" >> /etc/php81/mods-available/mongodb.ini
1320

14-
RUN apk add php7-pecl-pcov --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing
21+
RUN apt install wget -y
1522

1623
RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
1724
&& tar -C /usr/local/bin -xzvf dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
1825
&& rm dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz
1926

20-
RUN apk --no-cache add
21-
2227
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
2328

24-
WORKDIR /
25-
2629
COPY entrypoint.sh /entrypoint.sh
2730
RUN chmod +x /entrypoint.sh
2831

29-
30-
ENTRYPOINT ["entrypoint.sh"]
32+
ENTRYPOINT ["entrypoint.sh"]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
export DEBIAN_FRONTEND=noninteractive
33
bash <(cat /etc/os-release; echo 'echo ${VERSION/*, /}')
44
php -v
5-
echo "Entrypoint/Boot actions completed..."
5+
echo "Entrypoint/Boot actions completed..."

runLocalTestInDocker.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env bash
22
docker-compose up -d mariadb mongo &&
3-
docker-compose up php7 &&
4-
docker-compose up php8 &&
3+
docker-compose up php8 --build php8 &&
54
docker-compose down

src/LogToDbCustomLoggingHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class LogToDbCustomLoggingHandler extends AbstractProcessingHandler
2525
/**
2626
* LogToDbHandler constructor.
2727
*
28-
* @param array $config Logging configuration from logging.php
28+
* @param array $config Logging configuration from logging.php8
2929
* @param array $processors collection of log processors
3030
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
3131
*/

src/ServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function config_path($path = '')
3737
//Merge config first, then keep a publish option
3838
$this->mergeConfigFrom(__DIR__.'/config/logtodb.php', 'logtodb');
3939
$this->publishes([
40-
__DIR__.'/config/logtodb.php' => config_path('logtodb.php'),
40+
__DIR__.'/config/logtodb.php' => config_path('logtodb.php8'),
4141
], 'config');
4242

4343
//Publish the migration

0 commit comments

Comments
 (0)