-
Notifications
You must be signed in to change notification settings - Fork 2
/
Earthfile
76 lines (65 loc) · 1.88 KB
/
Earthfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
VERSION 0.7
FROM alpine
# renovate: datasource=docker depName=python
ARG --global PYTHON_VERSION=3.12
brultech-serial2mqtt:
ARG PYTHON_VERSION
ARG TARGETPLATFORM
FROM DOCKERFILE \
--build-arg PYTHON_VERSION=$PYTHON_VERSION \
-f docker/Dockerfile \
--platform $TARGETPLATFORM .
SAVE IMAGE brultech_serial2mqtt:latest
build:
BUILD --platform linux/amd64 +brultech-serial2mqtt
BUILD --platform linux/arm64 +brultech-serial2mqtt
python-requirements:
ARG PYTHON_VERSION
FROM python:$PYTHON_VERSION
WORKDIR /usr/src/app
COPY requirements.txt .
COPY setup.cfg .
COPY setup.py .
RUN pip install --no-cache-dir -r requirements.txt
python-dev-requirements:
FROM +python-requirements
WORKDIR /usr/src/app
COPY pyproject.toml .
COPY requirements-dev.txt .
RUN pip install --no-cache-dir -r requirements-dev.txt -r requirements.txt
pyright-image:
FROM +python-dev-requirements
RUN nodeenv /.cache/nodeenv
ENV PYRIGHT_PYTHON_ENV_DIR=/.cache/nodeenv
WORKDIR /usr/src/app
pyright-validate:
FROM +pyright-image
COPY --dir brultech_serial2mqtt/ .
COPY --dir tests/ .
COPY --dir typings/ .
RUN pyright
renovate-validate:
# renovate: datasource=docker depName=renovate/renovate versioning=docker
ARG RENOVATE_VERSION=38
FROM renovate/renovate:$RENOVATE_VERSION
WORKDIR /usr/src/app
COPY renovate.json .
RUN renovate-config-validator
ruff-validate:
FROM +python-dev-requirements
WORKDIR /usr/src/app
COPY pyproject.toml .
COPY --dir brultech_serial2mqtt .
COPY --dir tests .
COPY --dir typings/ .
RUN ruff check . --diff
RUN ruff format . --diff
lint:
BUILD +pyright-validate
BUILD +renovate-validate
BUILD +ruff-validate
test:
FROM +python-dev-requirements
COPY --dir brultech_serial2mqtt .
COPY --dir tests .
RUN pytest