diff --git a/.drone.jsonnet b/.drone.jsonnet index b36d93b..79f8cbb 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -95,7 +95,9 @@ local PipelineNotifications(depends_on=[]) = { [ PipelineBuild(os='linux', arch='amd64', version='gce'), + PipelineBuild(os='linux', arch='amd64', version='ec2'), PipelineNotifications(depends_on=[ - "gce-linux-amd64" + "gce-linux-amd64", + "ec2-linux-amd64" ]) ] diff --git a/.drone.yml b/.drone.yml index c39ffb1..0fb1def 100644 --- a/.drone.yml +++ b/.drone.yml @@ -36,6 +36,44 @@ steps: branch: - master +--- +kind: pipeline +name: ec2-linux-amd64 + +platform: + os: linux + arch: amd64 + +steps: +- name: dryrun + pull: always + image: plugins/docker:linux-amd64 + settings: + dockerfile: docker/Dockerfile.ec2.linux.amd64 + dry_run: true + password: + from_secret: docker_password + repo: xoxys/molecule + tags: ec2-linux-amd64 + username: + from_secret: docker_username + +- name: publish + pull: always + image: plugins/docker:linux-amd64 + settings: + auto_tag: true + auto_tag_suffix: ec2-linux-amd64 + dockerfile: docker/Dockerfile.ec2.linux.amd64 + password: + from_secret: docker_password + repo: xoxys/molecule + username: + from_secret: docker_username + when: + branch: + - master + --- kind: pipeline name: notifications @@ -89,5 +127,6 @@ trigger: depends_on: - gce-linux-amd64 +- ec2-linux-amd64 ... diff --git a/docker/Dockerfile.ec2.linux.amd64 b/docker/Dockerfile.ec2.linux.amd64 new file mode 100644 index 0000000..f450526 --- /dev/null +++ b/docker/Dockerfile.ec2.linux.amd64 @@ -0,0 +1,41 @@ +FROM python:3.7-alpine + +LABEL maintainer="Robert Kaussow " \ + org.label-schema.name="molecule" \ + org.label-schema.vcs-url="https://gitea.rknet.org/docker/molecule" \ + org.label-schema.vendor="Robert Kaussow" \ + org.label-schema.schema-version="1.0" + +ENV PACKAGES="\ + gcc \ + make \ + bash \ + libffi-dev \ + musl-dev \ + openssl-dev \ + python-dev \ + git \ + openssh-client \ +" + +ENV PIP_PACKAGES="\ + molecule[ec2] \ + virtualenv \ + apache-libcloud \ + pycrypto \ +" + +COPY ./ec2-entrypoint.sh /docker-entrypoint.sh + +RUN \ + apk update \ + && apk add --update --no-cache ${PACKAGES} \ + && rm -rf /var/cache/apk/* \ + && pip install --upgrade pip \ + && pip install --no-cache-dir ${PIP_PACKAGES} \ + && rm -rf /root/.cache \ + && mkdir /root/.ssh \ + && chmod 700 /root/.ssh + +USER root +ENTRYPOINT ["/docker-entrypoint.sh"] diff --git a/docker/Dockerfile.gce.linux.amd64 b/docker/Dockerfile.gce.linux.amd64 index faed80b..1d2407e 100644 --- a/docker/Dockerfile.gce.linux.amd64 +++ b/docker/Dockerfile.gce.linux.amd64 @@ -25,7 +25,7 @@ ENV PIP_PACKAGES="\ pycrypto \ " -COPY ./docker-entrypoint.sh / +COPY ./gce-entrypoint.sh /docker-entrypoint.sh RUN \ apk update \ diff --git a/docker/manifest.tmpl b/docker/manifest.tmpl index cb90bdb..96f2633 100644 --- a/docker/manifest.tmpl +++ b/docker/manifest.tmpl @@ -5,3 +5,8 @@ manifests: platform: architecture: amd64 os: linux + - + image: xoxys/molecule:ec2-linux-amd64 + platform: + architecture: amd64 + os: linux diff --git a/ec2-entrypoint.sh b/ec2-entrypoint.sh new file mode 100644 index 0000000..3bf7ede --- /dev/null +++ b/ec2-entrypoint.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +set -o pipefail +set -o errtrace +set -o nounset +set -o errexit + +if [ "$EC2_SSH_KEY" ]; then + echo "$EC2_SSH_KEY" > $HOME/.ssh/ec2_key + chmod 600 $HOME/.ssh/ec2_key +fi diff --git a/docker-entrypoint.sh b/gce-entrypoint.sh similarity index 100% rename from docker-entrypoint.sh rename to gce-entrypoint.sh