Skip to content

Commit

Permalink
reduce setup complexity
Browse files Browse the repository at this point in the history
  • Loading branch information
nstapelbroek committed Mar 26, 2024
1 parent d2b479f commit 2470f4a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 58 deletions.
17 changes: 9 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ dist: bionic

language: python

python: '3.11'
python: '3.12'

install: pipenv install --dev

services:
- docker

# By default, we build only on pushes to master or Pull Requests
if: type != push OR branch = latest

jobs:
Expand All @@ -19,14 +18,16 @@ jobs:
script: pipenv run ./crawler.py --region Utrecht

- stage: Build, Test and Publish
name: Build image
if: type = pull_request
install: docker pull nstapelbroek/estate-crawler:latest
script: make validate-pr
name: Linting
script: pipenv run black ./ --line-length 120 --check --diff

- stage: Build, Test and Publish
name: Build and publish image
if: branch = latest AND type != pull_request
install: docker pull nstapelbroek/estate-crawler:latest
script: make validate
after_success: printenv DOCKERHUB_PASSWORD | docker login --username nstapelbroekbot --password-stdin && docker tag nstapelbroek/estate-crawler:$TRAVIS_BRANCH docker.io/nstapelbroek/estate-crawler:$TRAVIS_BRANCH && docker push docker.io/nstapelbroek/estate-crawler
script: printenv DOCKERHUB_PASSWORD | docker login --username nstapelbroekbot --password-stdin && docker tag nstapelbroek/estate-crawler:$TRAVIS_BRANCH docker.io/nstapelbroek/estate-crawler:$TRAVIS_BRANCH && docker push docker.io/nstapelbroek/estate-crawler

allow_failures:
- stage: Build, Test and Publish
name: Security checks
script: pipenv check --system
26 changes: 6 additions & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.11.5-alpine3.18 AS base
FROM python:3.12-alpine3.19 AS base
RUN apk add --no-cache libxml2-dev libffi-dev gcc build-base libxslt-dev zlib-dev libffi-dev openssl-dev

ENV PIP_NO_CACHE_DIR=off
Expand All @@ -10,28 +10,14 @@ COPY Pipfile.lock /app/

RUN pipenv install --system --deploy

# App is for base images that do not need dev-dependencies
FROM base AS app
COPY . /app/

# test-base is for images that need dev-dependencies
FROM app AS test-base
FROM base AS dev
RUN pipenv install --system --deploy --dev
COPY . /app/

# release will form a base for shippable images that are meant to run the application
FROM app AS release
VOLUME buid

# Check is a "public" stage ensuring that language dependencies are safe
FROM test-base AS Check
RUN safety check
RUN pipenv check --system

# CodeStyle is a "public" stage that checks the codestyle of the application
FROM test-base AS CodeStyle
FROM dev AS lint
RUN black ./ --line-length 120 --check --diff

# The final release
FROM release As Prod
FROM base As release
COPY . /app/
ENTRYPOINT ["python", "crawler.py"]
CMD ["--region", "amsterdam"]
30 changes: 0 additions & 30 deletions Makefile

This file was deleted.

0 comments on commit 2470f4a

Please sign in to comment.