Skip to content

Commit

Permalink
Rework Docker build
Browse files Browse the repository at this point in the history
This was copied over from the `Makefile`, but we need to amend it slightly
to work with `just`.
  • Loading branch information
StevenMaude committed Aug 17, 2023
1 parent 1316e70 commit 5d8cbc2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_and_publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:
- name: Generate correct value for VERSION file
run: echo "$VERSION" > cohortextractor/VERSION
- name: Build docker
run: just docker-build ENV=prod VERSION=$VERSION
run: just docker-build prod
- name: Basic docker test
run: docker run cohortextractor --help
- name: Log into GitHub Container Registry
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_runner.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
with:
install-just: true
- name: Build docker
run: just docker-build ENV=dev
run: just docker-build dev
- name: Basic docker test
run: docker-compose run --rm -v $PWD:/workspace dev cohortextractor
- name: Run unit tests in docker
Expand Down
12 changes: 6 additions & 6 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,15 @@ upgrade env package="": virtualenv
FORCE=true "{{ just_executable() }}" requirements-{{ env }} $opts


# build the production Docker image
docker-build:
# build the Docker image
docker-build env="dev" *args="":
export BUILD_DATE=$(shell date +'%y-%m-%dT%H:%M:%S.%3NZ')
export REVISION=$(shell git rev-parse --short HEAD)
export VERSION=$(shell git describe --tags)
# We retrieve the version in GitHub Actions differently,
# so allow overriding this value.
export VERSION=${VERSION:-$(shell git describe --tags)}
export DOCKER_BUILDKIT=1
ENV=dev docker-compose build --pull $(ARGS) $(ENV)


docker-compose build --pull {{ args }} {{ env }}


# *args is variadic, 0 or more. This allows us to do `just test -k match`, for example.
Expand Down

0 comments on commit 5d8cbc2

Please sign in to comment.