diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..b69e77b --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +/.* + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1183410 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/vendor/ +/.phpunit.cache/ + diff --git a/.woodpecker.yml b/.woodpecker.yml new file mode 100644 index 0000000..60a3404 --- /dev/null +++ b/.woodpecker.yml @@ -0,0 +1,15 @@ +pipeline: + phpunit: + image: walkero/phpunit-alpine:php8.0-phpunit9 + commands: + - composer install + - phpunit + - echo -n "latest,1.0,1.0.0" > .tags + dockerbuild: + image: plugins/docker + settings: + repo: docker.noccylabs.info/pipeline-test + registry: docker.noccylabs.info + + + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8dc1324 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM composer:latest + +FROM php:8.0-cli-alpine + +WORKDIR /application + +COPY . /application +COPY --from=0 /usr/bin/composer /usr/bin/composer +RUN composer install + +ENTRYPOINT /application/hello + diff --git a/README.md b/README.md index c30fe86..749d4c8 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,8 @@ # docker-pipeline-test -Test pipeline with gitea→woodpecker→docker registry \ No newline at end of file +This is a repository with an example application to test a custom docker pipeline +using Gitea, Woodpecker and a private registry. + +- Runs phpunit against the code +- Builds image from Dockerfile, tags the image and pushes to repo + diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..17b115b --- /dev/null +++ b/composer.json @@ -0,0 +1,12 @@ +{ + "name": "noccy/docker-pipeline-test", + "description": "Pipeline test", + "type": "application", + "license": "MIT", + "require": {}, + "autoload": { + "psr-4": { + "Hello\\": "src/" + } + } +} diff --git a/hello b/hello new file mode 100755 index 0000000..fc2a8b6 --- /dev/null +++ b/hello @@ -0,0 +1,7 @@ +#!/usr/bin/env php +run(); diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000..21d3ddc --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,26 @@ + + + + + tests + + + + + + src + + + diff --git a/src/HelloApplication.php b/src/HelloApplication.php new file mode 100644 index 0000000..1442807 --- /dev/null +++ b/src/HelloApplication.php @@ -0,0 +1,17 @@ +getMessage(); + } + + public function getMessage() + { + return "Hello World!\n"; + } +} + diff --git a/tests/HelloApplicationTest.php b/tests/HelloApplicationTest.php new file mode 100644 index 0000000..2737483 --- /dev/null +++ b/tests/HelloApplicationTest.php @@ -0,0 +1,15 @@ +assertEquals("Hello World!\n", $app->getMessage()); + } +}