Use docker compose in build
This commit is contained in:
parent
fc5ac92685
commit
2dbe8bf16e
4 changed files with 18 additions and 11 deletions
12
.build.yml
12
.build.yml
|
@ -1,6 +1,7 @@
|
|||
image: archlinux
|
||||
packages:
|
||||
- docker
|
||||
- docker-compose
|
||||
sources:
|
||||
- https://git.sr.ht/~crocmagnon/blog
|
||||
secrets:
|
||||
|
@ -13,12 +14,13 @@ tasks:
|
|||
- setup_docker: |
|
||||
./blog/docker/setup-docker
|
||||
- build_and_test: |
|
||||
docker info
|
||||
docker login -u crocmagnon --password-stdin < .docker-secret
|
||||
docker pull crocmagnon/blog || true
|
||||
docker build --cache-from crocmagnon/blog:latest -t crocmagnon/blog blog/
|
||||
docker run -t --rm crocmagnon/blog /app/docker/runtests.sh
|
||||
docker push crocmagnon/blog
|
||||
cd blog
|
||||
docker-compose pull django tests || true
|
||||
docker-compose build --pull django
|
||||
docker-compose build tests
|
||||
docker-compose run tests
|
||||
docker-compose push django tests
|
||||
- deploy: |
|
||||
ssh blog -o StrictHostKeyChecking=no "/srv/blog/redeploy"
|
||||
triggers:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
version: '2.4'
|
||||
services:
|
||||
django:
|
||||
image: crocmagnon/blog
|
||||
image: crocmagnon/blog:latest
|
||||
build: .
|
||||
ports:
|
||||
- 8000:8000
|
||||
|
@ -12,7 +12,7 @@ services:
|
|||
- ./static:/app/staticfiles
|
||||
restart: on-failure
|
||||
tests:
|
||||
image: crocmagnon/blog
|
||||
build: .
|
||||
command: ["/app/docker/runtests.sh"]
|
||||
healthcheck: {}
|
||||
image: crocmagnon/blog:tests
|
||||
build:
|
||||
context: .
|
||||
dockerfile: tests.Dockerfile
|
||||
|
|
|
@ -1,3 +1,2 @@
|
|||
#!/bin/sh
|
||||
pip install -r /app/requirements-dev.txt --progress-bar off
|
||||
TESTING=true python -m pytest
|
||||
|
|
6
tests.Dockerfile
Normal file
6
tests.Dockerfile
Normal file
|
@ -0,0 +1,6 @@
|
|||
FROM crocmagnon/blog
|
||||
RUN pip install -r requirements-dev.txt
|
||||
ENV TESTING "true"
|
||||
WORKDIR /app
|
||||
HEALTHCHECK none
|
||||
CMD ["python", "-m", "pytest"]
|
Reference in a new issue