-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Adiciona Docker e comandos via Makefile
- Loading branch information
Showing
12 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM python:3.12.1-slim | ||
|
||
# Virtual environment | ||
RUN python3 -m venv /opt/venv | ||
ENV PATH="/opt/venv/bin:$PATH" | ||
|
||
# Install requirements | ||
# hadolint ignore=DL3013 | ||
RUN pip3 install --no-cache-dir --upgrade pip | ||
COPY requirements.txt /tmp/requirements.txt | ||
RUN pip3 install --no-cache-dir --requirement /tmp/requirements.txt | ||
|
||
# Set environment variables | ||
ENV WORKDIR=/app | ||
WORKDIR ${WORKDIR} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Variables | ||
APP_NAME=app | ||
ROOT=$(shell pwd) | ||
|
||
## Lint | ||
DOCKER_IMAGE_LINTER=alvarofpp/linter:latest | ||
LINT_COMMIT_TARGET_BRANCH=origin/main | ||
|
||
## Test | ||
TEST_CONTAINER_NAME=${APP_NAME}_test | ||
|
||
# Commands | ||
.PHONY: install-hooks | ||
install-hooks: | ||
git config core.hooksPath .githooks | ||
|
||
.PHONY: build | ||
build: install-hooks | ||
@docker compose build --pull | ||
|
||
.PHONY: build-no-cache | ||
build-no-cache: install-hooks | ||
@docker compose build --no-cache --pull | ||
|
||
.PHONY: lint | ||
lint: | ||
@docker pull ${DOCKER_IMAGE_LINTER} | ||
@docker run --rm -v ${ROOT}:/app ${DOCKER_IMAGE_LINTER} " \ | ||
lint-commit ${LINT_COMMIT_TARGET_BRANCH} \ | ||
&& lint-markdown \ | ||
&& lint-dockerfile \ | ||
&& lint-yaml \ | ||
&& lint-shell-script \ | ||
&& lint-python" | ||
|
||
.PHONY: test | ||
test: | ||
@docker compose run --rm -v ${ROOT}:/app \ | ||
--name ${TEST_CONTAINER_NAME} ${APP_NAME} \ | ||
pytest | ||
|
||
.PHONY: test-coverage | ||
test-coverage: | ||
@docker compose run --rm -v ${ROOT}:/app \ | ||
--name ${TEST_CONTAINER_NAME} ${APP_NAME} \ | ||
/bin/bash -c "coverage run -m unittest discover tests && coverage report -m" | ||
|
||
.PHONY: shell | ||
shell: | ||
@docker compose run --rm ${APP_NAME} bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
version: '3.8' | ||
|
||
services: | ||
app: | ||
build: | ||
context: . | ||
image: alvarofpp/validate-docbr | ||
container_name: validate-docbr | ||
volumes: | ||
- .:/app |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import unittest | ||
|
||
import validate_docbr as docbr | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import unittest | ||
|
||
import validate_docbr as docbr | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import unittest | ||
|
||
import validate_docbr as docbr | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import unittest | ||
|
||
import validate_docbr as docbr | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import unittest | ||
|
||
import validate_docbr as docbr | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import unittest | ||
|
||
import validate_docbr as docbr | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import unittest | ||
|
||
import validate_docbr as docbr | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import unittest | ||
|
||
import validate_docbr as docbr | ||
|
||
|
||
|