diff --git a/.drone.yml b/.drone.yml index 1b0fd1a..4f6cfbb 100644 --- a/.drone.yml +++ b/.drone.yml @@ -12,35 +12,27 @@ environment: DESTINATION_PREFIX: git.roboces.dev/catalin/halig steps: -- name: build_base - image: gcr.io/kaniko-project/executor:debug - environment: - REGISTRY_USERNAME: - from_secret: REGISTRY_USERNAME - REGISTRY_PASSWORD: - from_secret: REGISTRY_PASSWORD +- name: restore cache + image: meltwater/drone-cache + settings: + restore: true + mount: + - .venv + +- name: install dependencies + image: git.roboces.dev/catalin/poetry:beta commands: - - set -euo pipefail - - mkdir -p /kaniko/.docker - - echo "{\"auths\":{\"$REGISTRY_HOST\":{\"username\":\"$REGISTRY_USERNAME\",\"password\":\"$REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json - - > - /kaniko/executor \ - --cache=true \ - --target base \ - --context /drone/src \ - --dockerfile Dockerfile \ - --destination "$DESTINATION_PREFIX:base-$DRONE_COMMIT_SHA" - - > - /kaniko/executor \ - --cache=true \ - --target linters \ - --context /drone/src \ - --dockerfile Dockerfile \ - --destination "$DESTINATION_PREFIX:linters-$DRONE_COMMIT_SHA" + - poetry config virtualenvs.in-project 1 + - poetry install --with linters + +- name: rebuild cache + image: meltwater/drone-cache + settings: + restore: true + mount: + - .venv - name: lint - image: $$DESTINATION_PREFIX:linters-c84d285a66f69b9e426d52cd67c74e464a4605f6 - # image: git.roboces.dev/catalin/halig:linters-$$DRONE_COMMIT_SHA} - # $DESTINATION_PREFIX:linters-$DRONE_COMMIT_SHA + image: python:3.10-slim commands: - - pre-commit run --all-files --color always + - ./venv/bin/pre-commit run --all-files --color always diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index ef9e69e..0000000 --- a/Dockerfile +++ /dev/null @@ -1,33 +0,0 @@ -FROM python:3.10-alpine AS base -RUN apk add --no-cache \ - curl \ - gcc \ - libressl-dev \ - musl-dev \ - git \ - libffi-dev \ - tzdata \ - && curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal \ - && source $HOME/.cargo/env \ - && curl -sSL https://install.python-poetry.org | python3 - --preview \ - && ln -fs /root/.local/bin/poetry /usr/local/bin \ - && rm -rf /root/.rustup \ - && apk del \ - curl \ - gcc \ - libressl-dev \ - musl-dev \ - libffi-dev \ - && mkdir /app - -ENV TZ Europe/Madrid - -COPY poetry.lock /app -COPY pyproject.toml /app -WORKDIR /app - -RUN poetry config virtualenvs.create false \ - && poetry install --without linters - -FROM base AS linters -RUN poetry install --only linters