add Docker and Drone boilerplate
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
This commit is contained in:
parent
5512a19e1f
commit
4da6e4b064
|
|
@ -0,0 +1,45 @@
|
|||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: default
|
||||
|
||||
steps:
|
||||
- name: install
|
||||
image: composer
|
||||
volumes:
|
||||
- name: composer-cache
|
||||
path: /tmp/cache
|
||||
environment:
|
||||
COMPOSER_CACHE_DIR: /tmp/cache
|
||||
commands:
|
||||
- composer install --no-progress --no-interaction --no-dev --optimize-autoloader
|
||||
|
||||
- name: unit tests
|
||||
image: php:7.4
|
||||
commands:
|
||||
- vendor/bin/phpunit -c phpunit.xml
|
||||
|
||||
- name: build image
|
||||
image: docker
|
||||
volumes:
|
||||
- name: dockersock
|
||||
path: /var/run/docker.sock
|
||||
commands:
|
||||
- docker build -t notecat:latest .
|
||||
|
||||
- name: deploy on testing
|
||||
image: docker/compose
|
||||
volumes:
|
||||
- name: dockersock
|
||||
path: /var/run/docker.sock
|
||||
commands:
|
||||
- docker-compose -f docker/docker-compose.testing.yml up --build --detach
|
||||
|
||||
volumes:
|
||||
- name: composer-cache
|
||||
host:
|
||||
path: /tmp/drone/composer-cache
|
||||
|
||||
- name: dockersock
|
||||
host:
|
||||
path: /var/run/docker.sock
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
FROM php:7.4-apache
|
||||
|
||||
WORKDIR /var/www
|
||||
|
||||
RUN sed -ri -e 's!/var/www/html!/var/www/public!g' /etc/apache2/sites-available/*.conf
|
||||
|
||||
COPY vendor/ /var/www/vendor/
|
||||
COPY public/ /var/www/public/
|
||||
COPY src/ /var/www/src/
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
### Variables
|
||||
DOCKER_COMPOSE_CMD := docker-compose -f docker/docker-compose.local.yml
|
||||
COMPOSER := composer
|
||||
PHPUNIT := vendor/bin/phpunit
|
||||
|
||||
.PHONY: build up down logs install test phpunit open_coverage
|
||||
|
||||
|
||||
### Container management
|
||||
build:
|
||||
${DOCKER_COMPOSE_CMD} build
|
||||
|
||||
up:
|
||||
${DOCKER_COMPOSE_CMD} up --build --detach
|
||||
|
||||
down:
|
||||
${DOCKER_COMPOSE_CMD} down
|
||||
|
||||
logs:
|
||||
${DOCKER_COMPOSE_CMD} logs -f || true
|
||||
|
||||
|
||||
### Dependency management
|
||||
install:
|
||||
${COMPOSER} install
|
||||
|
||||
|
||||
### Test suites
|
||||
test: phpunit
|
||||
|
||||
phpunit:
|
||||
${PHPUNIT} -c phpunit.xml
|
||||
|
||||
open_coverage:
|
||||
${BROWSER} coverage/index.html
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
version: '3'
|
||||
|
||||
services:
|
||||
web:
|
||||
build: ..
|
||||
restart: always
|
||||
ports:
|
||||
- 8080:80
|
||||
volumes:
|
||||
- ../:/var/www/
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
version: '3'
|
||||
|
||||
services:
|
||||
web:
|
||||
build: ..
|
||||
restart: always
|
||||
networks:
|
||||
- traefik
|
||||
labels:
|
||||
- traefik.enable=true
|
||||
- traefik.http.routers.notecat.rule=Host(`notecat.dev.0xbd.space`)
|
||||
- traefik.http.routers.notecat.tls=true
|
||||
- traefik.http.routers.notecat.tls.certresolver=letsencrypt
|
||||
|
||||
networks:
|
||||
traefik:
|
||||
external: true
|
||||
Loading…
Reference in New Issue