Skip to content

[Docker] a little performance increase in (re)build time and note added. #494

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 32 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,44 @@ FROM base AS lint
ENV WORKDIR=/app
WORKDIR ${WORKDIR}

COPY ./src ${WORKDIR}/src
RUN apk add --update --no-cache make nodejs npm
RUN apk add --update --no-cache yamllint

RUN npm install -g --ignore-scripts markdownlint-cli
RUN npm install -g --ignore-scripts pyright

# [!TIP] Use a bind-mount to "/app" to override following "copys"
# for lint and test against "current" sources in this stage

# YAML sources
COPY ./.github ${WORKDIR}/
COPY ./compose.yaml ${WORKDIR}/

# Markdown sources
COPY ./docs ${WORKDIR}/
COPY ./README.md ${WORKDIR}/
COPY ./LICENSE.md ${WORKDIR}/
COPY ./CODE_OF_CONDUCT.md ${WORKDIR}/

# Code source
COPY ./src ${WORKDIR}/
COPY ./requirements.txt ${WORKDIR}/
COPY ./setup.cfg ${WORKDIR}/
COPY ./Makefile ${WORKDIR}/

# markdownlint conf
COPY ./.markdownlint.yaml ${WORKDIR}/

# yamllint conf
COPY ./.yamllint ${WORKDIR}/
COPY ./.yamlignore ${WORKDIR}/

# pylint and covergae
COPY ./.pylintrc ${WORKDIR}/
COPY ./.coveragerc ${WORKDIR}/

CMD ["make", "lint"]

###############################################################################
FROM base AS development

Expand Down Expand Up @@ -46,7 +77,6 @@ ENV BRUTEFORCE=false

WORKDIR /app

COPY ./.pylintrc ${WORKDIR}/
COPY ./.coveragerc ${WORKDIR}/
RUN ls -alh

Expand All @@ -68,8 +98,6 @@ RUN chown worker:worker /app

WORKDIR /app

COPY ./.pylintrc ${WORKDIR}/
COPY ./.coveragerc ${WORKDIR}/
RUN ls -alh

USER worker
Expand Down
2 changes: 1 addition & 1 deletion LICENSE → LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MIT License
# MIT License

Copyright (c) 2022 Gonzalo Diaz

Expand Down
13 changes: 8 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,17 @@ test/styling: dependencies
${RUNTIME_TOOL} -m pycodestyle --statistics src/

test: env dependencies
${RUNTIME_TOOL} -m pytest --verbose -o log_cli=true --log-cli-level=${LOG_LEVEL} --full-trace src/
${RUNTIME_TOOL} -m coverage run -m \
pytest --verbose \
-o log_cli=true \
--log-cli-level=${LOG_LEVEL} \
--full-trace src/
${RUNTIME_TOOL} -m coverage report

coverage: dependencies
${RUNTIME_TOOL} -m coverage run -m pytest --verbose src/
coverage: test
${RUNTIME_TOOL} -m coverage lcov -o coverage/lcov.info
${RUNTIME_TOOL} -m coverage report

coverage/html: coverage
coverage/html: test
${RUNTIME_TOOL} -m coverage html

outdated:
Expand Down