Compare commits

..

No commits in common. "cb28a8b31aa87381c00cc3a9e4813d4e9a4d545a" and "f9f6cbc02a3e3f3cb624a73d5664be1b3a208da6" have entirely different histories.

3 changed files with 28 additions and 4 deletions

View File

@ -6,6 +6,10 @@ name: Build
steps:
- name: build_release
image: plugins/docker
commands:
- sleep 5
- docker build -t docker.pbiernat.dev/nginx-php .
- docker images | grep nginx-php
when:
event: tag
volumes:
@ -19,6 +23,10 @@ steps:
from_secret: registry_username
DOCKER_PASSWORD:
from_secret: registry_password
commands:
- sleep 5
# - docker login docker.pbiernat.dev -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
# - docker push docker.pbiernat.dev/nginx-php
when:
event: tag
volumes:
@ -28,6 +36,8 @@ steps:
- name: build_develop
image: plugins/docker
commands:
- sleep 5
#- env
- ./scripts/drone-build.sh
when:
branch: develop
@ -39,12 +49,16 @@ steps:
- name: publish_develop
image: plugins/docker
# privileged: true
environment:
DOCKER_USERNAME:
from_secret: registry_username
DOCKER_PASSWORD:
from_secret: registry_password
commands:
- sleep 5
# - docker login docker.pbiernat.dev -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
# - docker push docker.pbiernat.dev/nginx-php:dev
- ./scripts/drone-publish.sh
when:
branch: develop
@ -57,6 +71,10 @@ steps:
- name: build_feature
image: plugins/docker
commands:
- env
- sleep 5
#- docker build -t docker.pbiernat.dev/nginx-php:$CI_COMMIT_BRANCH .
#- docker images --format "{{.Repository}}:{{.Tag}}" | grep nginx-php:${CI_COMMIT_BRANCH}
- ./scripts/drone-build.sh
when:
branch:
@ -71,12 +89,17 @@ steps:
- name: publish_feature
image: plugins/docker
# privileged: true
environment:
DOCKER_USERNAME:
from_secret: registry_username
DOCKER_PASSWORD:
from_secret: registry_password
commands:
# - env
- sleep 5
#- docker login docker.pbiernat.dev -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
#- docker push docker.pbiernat.dev/nginx-php:$CI_COMMIT_BRANCH
- ./scripts/drone-publish.sh
when:
branch: develop
@ -97,4 +120,3 @@ services:
volumes:
- name: docker-sock
temp: {}

View File

@ -21,19 +21,19 @@ source_branch=$DRONE_SOURCE_BRANCH
step_name=$DRONE_STEP_NAME
if { contains "$branch" "feature_" && [ "$event" = push ]; } ; then
sleep 5
echo "BUILD FEATURE: $branch"
docker build -t docker.pbiernat.dev/nginx-php:$branch .
return 0
fi
if { [ "$branch" = develop ] && [ "$event" = pull_request ]; } ; then
sleep 5
echo "BUILD FEATURE(FROM DEV): $source_branch"
docker build -t docker.pbiernat.dev/nginx-php:$source_branch .
return 0
fi
if { [ "$branch" = develop ] && [ "$event" = push ] && [ "$step_name" != build_feature ]; } ; then
sleep 5
echo "BUILD DEV"
docker build -t docker.pbiernat.dev/nginx-php:dev .
return 0
fi

View File

@ -20,11 +20,13 @@ source_branch=$DRONE_SOURCE_BRANCH
docker login docker.pbiernat.dev -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
if { [ "$branch" = develop ] && [ "$event" = pull_request ]; } ; then
echo "PUSH FEATURE: $source_branch"
docker push docker.pbiernat.dev/nginx-php:$source_branch
return 0
fi
if { [ "$branch" = develop ] && [ "$event" = push ]; } ; then
echo "PUSH DEV: $branch"
docker push docker.pbiernat.dev/nginx-php:dev
return 0
fi