From 8314053506e952039950f5f6ea443427123c6891 Mon Sep 17 00:00:00 2001 From: Victor LABORIE Date: Mon, 17 Jun 2019 13:36:46 +0200 Subject: [PATCH] Add DroneCI config for build Docker image --- .drone.yml | 36 ++++++++++++++++++++++++++++++++++++ Dockerfile | 20 ++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 .drone.yml create mode 100644 Dockerfile diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 00000000..514a8b3f --- /dev/null +++ b/.drone.yml @@ -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 + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..b65c62ab --- /dev/null +++ b/Dockerfile @@ -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"]