Skip to content

Commit

Permalink
Only build the package once
Browse files Browse the repository at this point in the history
  • Loading branch information
avirshup committed Feb 22, 2018
1 parent 8e00ccd commit 1f0be9a
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 69 deletions.
12 changes: 2 additions & 10 deletions Dockerfile
@@ -1,14 +1,6 @@
ARG PYVERSION=3.6
FROM python:${PYVERSION}-alpine

RUN apk add --no-cache curl git
ENV DOCKERVERSION=17.12.0-ce
RUN curl -fsSLO https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKERVERSION}.tgz \
&& mv docker-${DOCKERVERSION}.tgz docker.tgz \
&& tar xzvf docker.tgz \
&& mv docker/docker /usr/local/bin \
&& rm -r docker docker.tgz
FROM python:3.6-alpine

RUN apk add --no-cache git
ADD requirements.txt /tmp
RUN pip install -r /tmp/requirements.txt pytest

Expand Down
41 changes: 22 additions & 19 deletions codeship-services.yml
@@ -1,41 +1,44 @@
dmk-python2.7:
add_docker: true
working_dir: /opt/DockerMake/test
avirshup/docker-make: # this is the deployment artifact
build:
dockerfile: Dockerfile
context: .
args:
PYVERSION: "2.7"
volumes:
- "./codeship-distfiles:/opt/distfiles"

dmk-python3.5:
testenv-python2.7:
add_docker: true
working_dir: /opt/DockerMake/test
working_dir: /opt/test
volumes:
- "./codeship-distfiles:/opt/distfiles"
build:
dockerfile: Dockerfile
context: .
dockerfile: deployment/Dockerfile.testenv
args:
PYVERSION: "3.5"
PYVERSION: "2.7"

dmk-python3.6:
volumes:
- "./codeship-distfiles:/opt/DockerMake/dist"
testenv-python3.5:
add_docker: true
working_dir: /opt/DockerMake/test
working_dir: /opt/test
volumes:
- "./codeship-distfiles:/opt/distfiles"
build:
dockerfile: Dockerfile
context: .
dockerfile: deployment/Dockerfile.testenv
args:
PYVERSION: "3.6"
PYVERSION: "3.5"

avirshup/docker-make: # this is the deployment artifact
testenv-python3.6:
add_docker: true
working_dir: /opt/test
volumes:
- "./codeship-distfiles:/opt/distfiles"
build:
dockerfile: Dockerfile
context: .
dockerfile: deployment/Dockerfile.testenv
args:
PYVERSION: "3.6"


dmk-deploy-img:
deploy-env:
add_docker: true
build:
context: deployment/
Expand Down
19 changes: 11 additions & 8 deletions codeship-steps.yml
@@ -1,23 +1,26 @@
- name: build-pkg
service: avirshup/docker-make
command: sh -c 'cp -v /opt/DockerMake/dist/DockerMake-*.tar.gz /opt/distfiles/'

- name: test
type: serial
services:
- dmk-python2.7
- dmk-python3.5
- dmk-python3.6
- testenv-python2.7
- testenv-python3.5
- testenv-python3.6
steps:
- command: py.test

- command: sh -c "pip install /opt/distfiles/DockerMake-*.tar.gz && py.test"

- name: deploy-dockerhub
type: push
service: dmk-deploy-img
service: deploy-env
tag: '^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)((a|rc|b)(0|[1-9]\d*))?$' # PEP440 version tags
image_name: avirshup/docker-make
image_tag: "{{.Branch}}"
registry: https://index.docker.io/v1


- name: deploy-pypi
service: dmk-deploy-img
command: deploy.sh
service: deploy-env
command: twine upload -u ${PYPI_USER} -p ${PYPI_PASSWORD} /opt/distfiles/DockerMake-${CI_BRANCH}.tar.gz
tag: '^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)((a|rc|b)(0|[1-9]\d*))?$' # PEP440 version tags
6 changes: 1 addition & 5 deletions deployment/Dockerfile.deploy
@@ -1,6 +1,2 @@
FROM python:3.6-alpine
RUN mkdir -p /opt/dist
RUN apk add --no-cache docker \
&& pip install twine
ADD deploy.sh /usr/local/bin
RUN chmod +x /usr/local/bin/deploy.sh
RUN pip install twine
14 changes: 14 additions & 0 deletions deployment/Dockerfile.testenv
@@ -0,0 +1,14 @@
ARG PYVERSION=3.6
FROM python:${PYVERSION}-alpine

RUN apk add --no-cache curl git
ENV DOCKERVERSION=17.12.0-ce
RUN curl -fsSLO https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKERVERSION}.tgz \
&& mv docker-${DOCKERVERSION}.tgz docker.tgz \
&& tar xzvf docker.tgz \
&& mv docker/docker /usr/local/bin \
&& rm -r docker docker.tgz

RUN pip install pytest
ADD test /opt/test
ADD example /opt/example
26 changes: 0 additions & 26 deletions deployment/deploy.sh

This file was deleted.

1 change: 0 additions & 1 deletion setup.py
Expand Up @@ -20,5 +20,4 @@
]
},
install_requires=requirements,

)

0 comments on commit 1f0be9a

Please sign in to comment.