Add DroneCI config for build Docker image

This commit is contained in:
Victor LABORIE 2019-06-17 13:36:46 +02:00
parent 317aac735f
commit 8314053506
2 changed files with 56 additions and 0 deletions

36
.drone.yml Normal file
View File

@ -0,0 +1,36 @@
kind: pipeline
name: default
steps:
- name: build tagged docker image
image: plugins/docker
settings:
username:
from_secret: docker_username
password:
from_secret: docker_password
dockerfile: Dockerfile
repo: evolix/ansible-roles
auto_tag: true
environment:
ROLES_VERSION: $DRONE_COMMIT_SHA
when:
event:
- tag
- name: build latest docker image
image: plugins/docker
settings:
username:
from_secret: docker_username
password:
from_secret: docker_password
dockerfile: Dockerfile
repo: evolix/ansible-roles
tags: latest
environment:
ROLES_VERSION: $DRONE_COMMIT_SHA
when:
branch:
- unstable

20
Dockerfile Normal file
View File

@ -0,0 +1,20 @@
FROM debian:stretch-slim
ENV ROLES_VERSION=${ROLES_VERSION:-unstable}
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
git \
ansible \
&& rm -rf /var/lib/apt/lists/*
RUN ansible-galaxy install --force \
--roles-path /etc/ansible \
"git+https://gitea.evolix.org/evolix/ansible-roles.git,${ROLES_VERSION},roles"
ENV ANSIBLE_FORCE_COLOR=1
ENV ANSIBLE_HOST_KEY_CHECKING=false
ENV ANSIBLE_RETRY_FILES_ENABLED=false
ENV PYTHONUNBUFFERED=1
ENTRYPOINT ["ansible-playbook"]