Update build
This commit is contained in:
parent
7e6bcf3e40
commit
e562e8ed1c
4 changed files with 24 additions and 7 deletions
|
@ -1,7 +1,7 @@
|
||||||
##############################################
|
##############################################
|
||||||
# Build virtualenv
|
# Build virtualenv
|
||||||
##############################################
|
##############################################
|
||||||
FROM python:3.10.1-buster AS venv
|
FROM python:3.10.2-buster AS venv
|
||||||
|
|
||||||
# Prepare system
|
# Prepare system
|
||||||
##############################################
|
##############################################
|
||||||
|
@ -47,9 +47,9 @@ RUN git rev-parse HEAD | tee /version
|
||||||
##############################################
|
##############################################
|
||||||
# Main image
|
# Main image
|
||||||
##############################################
|
##############################################
|
||||||
FROM python:3.10.1-slim-buster as prod
|
FROM python:3.10.2-slim-buster as prod
|
||||||
|
|
||||||
RUN echo "Europe/Paris" > /etc/timezone
|
ENV TZ="Europe/Paris"
|
||||||
|
|
||||||
COPY --from=venv /app/venv /app/venv/
|
COPY --from=venv /app/venv /app/venv/
|
||||||
ENV PATH /app/venv/bin:$PATH
|
ENV PATH /app/venv/bin:$PATH
|
||||||
|
|
11
docker-compose-build.yaml
Normal file
11
docker-compose-build.yaml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
version: '2.4'
|
||||||
|
services:
|
||||||
|
django:
|
||||||
|
extends:
|
||||||
|
file: docker-compose.yaml
|
||||||
|
service: django
|
||||||
|
image: rg.fr-par.scw.cloud/crocmagnon/shortener:latest
|
||||||
|
platform: linux/amd64
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
shortener_data:
|
|
@ -2,7 +2,7 @@ version: "2.4"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
django:
|
django:
|
||||||
image: rg.fr-par.scw.cloud/crocmagnon/shortener
|
image: shortener-dev
|
||||||
build: .
|
build: .
|
||||||
env_file: envs/docker.env
|
env_file: envs/docker.env
|
||||||
ports:
|
ports:
|
||||||
|
|
12
tasks.py
12
tasks.py
|
@ -16,6 +16,8 @@ from invoke import Context, task
|
||||||
|
|
||||||
BASE_DIR = Path(__file__).parent.resolve(strict=True)
|
BASE_DIR = Path(__file__).parent.resolve(strict=True)
|
||||||
SRC_DIR = BASE_DIR / "src"
|
SRC_DIR = BASE_DIR / "src"
|
||||||
|
COMPOSE_BUILD_FILE = BASE_DIR / "docker-compose-build.yaml"
|
||||||
|
COMPOSE_BUILD_ENV = {"COMPOSE_FILE": COMPOSE_BUILD_FILE}
|
||||||
|
|
||||||
|
|
||||||
@task
|
@task
|
||||||
|
@ -28,7 +30,7 @@ def test(ctx: Context) -> None:
|
||||||
def test_cov(ctx: Context) -> None:
|
def test_cov(ctx: Context) -> None:
|
||||||
with ctx.cd(SRC_DIR):
|
with ctx.cd(SRC_DIR):
|
||||||
ctx.run(
|
ctx.run(
|
||||||
"pytest --cov=. --cov-report term-missing:skip-covered",
|
"pytest --cov=. --cov-branch --cov-report term-missing:skip-covered",
|
||||||
pty=True,
|
pty=True,
|
||||||
echo=True,
|
echo=True,
|
||||||
)
|
)
|
||||||
|
@ -48,13 +50,17 @@ def check(ctx: Context) -> None:
|
||||||
@task
|
@task
|
||||||
def build(ctx: Context) -> None:
|
def build(ctx: Context) -> None:
|
||||||
with ctx.cd(BASE_DIR):
|
with ctx.cd(BASE_DIR):
|
||||||
ctx.run("docker-compose build django", pty=True, echo=True)
|
ctx.run(
|
||||||
|
"docker-compose build django", pty=True, echo=True, env=COMPOSE_BUILD_ENV
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@task
|
@task
|
||||||
def publish(ctx: Context) -> None:
|
def publish(ctx: Context) -> None:
|
||||||
with ctx.cd(BASE_DIR):
|
with ctx.cd(BASE_DIR):
|
||||||
ctx.run("docker-compose push django", pty=True, echo=True)
|
ctx.run(
|
||||||
|
"docker-compose push django", pty=True, echo=True, env=COMPOSE_BUILD_ENV
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@task
|
@task
|
||||||
|
|
Loading…
Reference in a new issue