From 8b4938cb925a550d587867cf50d2d98df06d9f72 Mon Sep 17 00:00:00 2001 From: MarkKoz Date: Fri, 21 Feb 2020 18:05:20 -0800 Subject: CI: install dev dependencies inside running container This change allows for the venv image to be pushed since it won't be built with dev dependencies. --- ci/build.yml | 16 ++++++++-------- ci/setup.yml | 8 +++++++- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/ci/build.yml b/ci/build.yml index 139203e..fcde2e1 100644 --- a/ci/build.yml +++ b/ci/build.yml @@ -6,7 +6,7 @@ steps: scriptPath: scripts/check_dockerfiles.sh disableAutoCwd: true - # Without a login the following Docker build tasks won't add image tags. + # Without a login, the following Docker build steps wouldn't add image tags. - task: Docker@1 displayName: 'Log into Docker Hub' inputs: @@ -14,9 +14,9 @@ steps: containerregistrytype: 'Container Registry' dockerRegistryEndpoint: 'DockerHub' - # The venv image depends on this image. Build it if it can't be pulled - # from Docker Hub, which will be the case if the base Dockerfile has had - # changes. + # Building the venv depends on this base image. Build the base if it can't + # pulled from Docker Hub, which will be the case if the base Dockerfile has + # has had changes. - script: | docker build \ -f docker/base.Dockerfile \ @@ -25,11 +25,11 @@ steps: displayName: 'Build Base Image' condition: and(succeeded(), ne(variables['check.BASE_PULL'], True)) - # The dev image is never pushed and therefore is always built. + # Build the venv image if it's had changes. - script: | docker build \ -f docker/venv.Dockerfile \ - -t pythondiscord/snekbox-venv:dev \ - --build-arg DEV=1 \ + -t pythondiscord/snekbox-venv:latest \ . - displayName: 'Build Development Image' + displayName: 'Build Virtual Environment Image' + condition: and(succeeded(), ne(variables['check.VENV_CHANGED'], False)) diff --git a/ci/setup.yml b/ci/setup.yml index 25530e7..cf190de 100644 --- a/ci/setup.yml +++ b/ci/setup.yml @@ -1,5 +1,6 @@ steps: # The linter and all tests run inside this container. + # The venv image will be pulled if it doesn't exist locally. - script: | docker run \ --tty \ @@ -14,5 +15,10 @@ steps: --volume "${PWD}":"${PWD}" \ --workdir "${PWD}"\ --entrypoint /bin/bash \ - pythondiscord/snekbox-venv:dev + pythondiscord/snekbox-venv:latest displayName: 'Start Container' + + - script: | + docker exec snekbox_test /bin/bash -c \ + 'pipenv install --system --deploy --dev' + displayName: 'Install Development Dependencies' -- cgit v1.2.3