-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathEarthfile
51 lines (40 loc) · 1.34 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
VERSION 0.8
FROM python:3.9
WORKDIR /app
ARG EARTHLY_GIT_PROJECT_NAME
ARG --global CACHE_BASE=ghcr.io/$EARTHLY_GIT_PROJECT_NAME
kubectl:
ARG KUBECTL_VERSION=v1.31.3
RUN wget https://cdn.dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl && \
chmod a+x kubectl
SAVE ARTIFACT kubectl
SAVE IMAGE --push ${CACHE_BASE}-kubectl:cache
build:
RUN pip install poetry
ENV POETRY_VIRTUALENVS_IN_PROJECT=true
COPY pyproject.toml poetry.lock .
RUN poetry install --no-root --no-interaction
COPY --dir .prospector.yaml dataproduct_apps tests .
RUN poetry install --no-interaction && \
poetry run prospector && \
poetry run pytest
RUN poetry install --no-interaction
SAVE ARTIFACT .venv
SAVE ARTIFACT dataproduct_apps
SAVE IMAGE --push ${CACHE_BASE}-build:cache
tests:
LOCALLY
RUN poetry install --no-interaction && \
poetry run prospector && \
poetry run pytest
docker:
# Ensure images are pushed to cache for these targets
BUILD +kubectl
BUILD +build
COPY --dir +build/.venv +build/dataproduct_apps .
COPY +kubectl/kubectl /usr/local/bin/
ENV PATH="/app/.venv/bin:$PATH"
ARG EARTHLY_GIT_SHORT_HASH
ARG IMAGE_TAG=$EARTHLY_GIT_SHORT_HASH
ARG IMAGE=nais/dataproduct-apps
SAVE IMAGE --push ${IMAGE}:${IMAGE_TAG} ${IMAGE}:latest