Skip to content

Commit 4ac90c5

Browse files
First commit
0 parents  commit 4ac90c5

File tree

7 files changed

+274
-0
lines changed

7 files changed

+274
-0
lines changed

.dockerignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.git/
2+
vendor/

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.git/
2+
vendor/

Dockerfile

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
FROM composer/composer:php7 as vendor
2+
3+
4+
WORKDIR /tmp/
5+
6+
COPY composer.json composer.json
7+
COPY composer.lock composer.lock
8+
9+
10+
RUN composer install \
11+
--ignore-platform-reqs \
12+
--no-interaction \
13+
--no-plugins \
14+
--no-scripts \
15+
--prefer-dist
16+
17+
18+
FROM php:7.2-apache-stretch
19+
20+
COPY . /var/www/html
21+
COPY --from=vendor /tmp/vendor/ /var/www/html/vendor/
22+

Readme.md

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Codefresh Php example
2+
3+
Original source: https://laravel-news.com/multi-stage-docker-builds-for-laravel
4+
5+
## Build locally
6+
7+
Normal docker build
8+
9+
`docker build . -t php-sample-app`
10+
11+
12+
## Run locally
13+
14+
`docker run -p 8080:80 php-sample-app`
15+
16+
and then visit in your browser
17+
18+
* http://localhost:8080/
19+
20+
## Build in Codefresh
21+
22+
Example pipeline:
23+
24+
* [Simple pipeline](codefresh.yml)
25+
26+
27+
Read https://codefresh.io/docs/docs/learn-by-example/php/ for more details
28+
29+
30+

composer.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "codefresh-contrib/php-composer-sample-app",
3+
"description": "Example php project for Codefresh pipelines",
4+
"type": "project",
5+
"require": {
6+
"monolog/monolog": "^1.24",
7+
"phpunit/php-timer": "^1.0.9"
8+
},
9+
"authors": [
10+
{
11+
"name": "Kostis Kapelonis",
12+
"email": "[email protected]"
13+
}
14+
]
15+
}

composer.lock

+192
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.php

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<p>
2+
Example timer in PHP
3+
</p>
4+
5+
6+
<?php
7+
require('vendor/autoload.php');
8+
\PHP_Timer::start();
9+
sleep(rand(1, 3));
10+
$time = \PHP_Timer::stop();
11+
print \PHP_Timer::secondsToTimeString($time);

0 commit comments

Comments
 (0)