Skip to content

Commit 3bf4841

Browse files
committed
build: Adds Docker and Makefile
1 parent 351dad4 commit 3bf4841

File tree

6 files changed

+94
-19
lines changed

6 files changed

+94
-19
lines changed

.githooks/pre-push

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/sh
2+
3+
warning() {
4+
# shellcheck disable=2028
5+
echo "\\e[1;33m$1"
6+
}
7+
8+
alertMessages() {
9+
warning "One or more $1 are failing."
10+
warning "Please fix those $1 before pushing your branch"
11+
}
12+
13+
if make lint; then
14+
exit 0
15+
else
16+
alertMessages "linter checks"
17+
exit 1
18+
fi

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
11
.idea/
22
venv/
3+
4+
*.csv
5+
!data/extract/.gitkeep
6+
!data/air_traffic.graphml
7+
!data/airports.csv
8+
!data/anac.csv.lrz

Dockerfile

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM python:3.12.1-slim
2+
3+
# Virtual environment
4+
RUN python3 -m venv /opt/venv
5+
ENV PATH="/opt/venv/bin:$PATH"
6+
7+
# Install requirements
8+
# hadolint ignore=DL3013
9+
RUN pip3 install --no-cache-dir --upgrade pip
10+
COPY requirements.txt /tmp/requirements.txt
11+
RUN pip3 install --no-cache-dir --requirement /tmp/requirements.txt
12+
13+
# Set environment variables
14+
ENV WORKDIR=/app
15+
WORKDIR ${WORKDIR}

Makefile

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Variables
2+
APP_NAME=dataset-flights-brazil
3+
ROOT=$(shell pwd)
4+
5+
## Lint
6+
DOCKER_IMAGE_LINTER=alvarofpp/linter:latest
7+
LINT_COMMIT_TARGET_BRANCH=origin/main
8+
9+
## Test
10+
TEST_CONTAINER_NAME=${APP_NAME}_test
11+
12+
# Commands
13+
.PHONY: install-hooks
14+
install-hooks:
15+
git config core.hooksPath .githooks
16+
17+
.PHONY: build
18+
build: install-hooks
19+
@docker compose build --pull
20+
21+
.PHONY: build-no-cache
22+
build-no-cache: install-hooks
23+
@docker compose build --no-cache --pull
24+
25+
.PHONY: lint
26+
lint:
27+
@docker pull ${DOCKER_IMAGE_LINTER}
28+
@docker run --rm -v ${ROOT}:/app ${DOCKER_IMAGE_LINTER} " \
29+
lint-commit ${LINT_COMMIT_TARGET_BRANCH} \
30+
&& lint-markdown \
31+
&& lint-dockerfile \
32+
&& lint-yaml \
33+
&& lint-shell-script \
34+
&& lint-python"
35+
36+
.PHONY: shell
37+
shell:
38+
@UID_GID="$(id -u):$(id -g)" docker compose run --rm ${APP_NAME} bash

docker-compose.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
version: '3.8'
3+
4+
services:
5+
dataset-flights-brazil:
6+
build:
7+
context: .
8+
image: alvarofpp/dataset-flights-brazil
9+
container_name: dataset-flights-brazil
10+
user: "${UID_GID}"
11+
volumes:
12+
- .:/app

requirements.txt

+5-19
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,6 @@
1-
beautifulsoup4==4.9.3
2-
certifi==2021.5.30
3-
charset-normalizer==2.0.3
4-
click==8.0.1
5-
decorator==5.0.9
6-
future==0.18.2
1+
beautifulsoup4==4.12.3
72
geocoder==1.38.1
8-
idna==3.2
9-
networkx==2.5.1
10-
numpy==1.21.1
11-
pandas==1.3.0
12-
pkg-resources==0.0.0
13-
python-dateutil==2.8.2
14-
pytz==2021.1
15-
ratelim==0.1.6
16-
requests==2.26.0
17-
six==1.16.0
18-
soupsieve==2.2.1
19-
tqdm==4.61.2
20-
urllib3==1.26.6
3+
networkx==3.2.1
4+
pandas==2.2.0
5+
requests==2.31.0
6+
tqdm==4.66.1

0 commit comments

Comments
 (0)