diff --git a/.drone.yml b/.drone.yml index 70a2cd3..b642aeb 100644 --- a/.drone.yml +++ b/.drone.yml @@ -3,30 +3,28 @@ type: docker name: default steps: - - name: build image - image: docker:24 - volumes: - - name: dockersock - path: /var/run/docker.sock + - name: build and push with kaniko + image: gcr.io/kaniko-project/executor:latest environment: DOCKER_USERNAME: from_secret: DOCKER_USERNAME CICD_TOKEN: from_secret: CICD_TOKEN - commands: - - docker login git.iamninja.ru -u "$DOCKER_USERNAME" -p "$CICD_TOKEN" - - docker build -t git.iamninja.ru/iamninja/pomodoro_tg_bot:latest . - - - name: push image - image: plugins/docker settings: registry: git.iamninja.ru repo: git.iamninja.ru/iamninja/pomodoro_tg_bot tags: latest - username: - from_secret: DOCKER_USERNAME - password: - from_secret: CICD_TOKEN + commands: + - | + /kaniko/executor \ + --dockerfile=Dockerfile \ + --context=. \ + --destination=git.iamninja.ru/iamninja/pomodoro_tg_bot:latest \ + --cache=true \ + --cache-repo=git.iamninja.ru/iamninja/pomodoro_tg_bot/cache \ + --skip-tls-verify \ + --username "$DOCKER_USERNAME" \ + --password "$CICD_TOKEN" - name: deploy to server image: appleboy/drone-ssh @@ -55,8 +53,3 @@ steps: - docker login git.iamninja.ru -u "$DOCKER_USERNAME" -p "$CICD_TOKEN" - docker compose pull - docker compose up -d - -volumes: - - name: dockersock - host: - path: /var/run/docker.sock diff --git a/Dockerfile b/Dockerfile index 8d29e89..d01d8fa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,6 +4,8 @@ WORKDIR /app COPY . . +ENV PYTHONPATH=/app + RUN pip install --no-cache-dir -r requirements.txt CMD ["python", "main.py"] \ No newline at end of file