-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5c28b42
commit 03db433
Showing
11 changed files
with
201 additions
and
1 deletion.
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,7 @@ | ||
# Ignore all | ||
** | ||
|
||
# with the exception of | ||
!main.py | ||
!requirements.txt | ||
!Makefile |
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,4 @@ | ||
[flake8] | ||
exclude = | ||
venv | ||
max-line-length = 120 |
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,26 @@ | ||
name: Main workflow | ||
|
||
on: [ pull_request ] | ||
|
||
jobs: | ||
main: | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
# Need this for any work with repository. | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install --requirement requirements.txt | ||
- name: Make autoformatting | ||
run: | | ||
black ./ | ||
- name: Check codestyle | ||
run: | | ||
flake8 ./ |
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,18 @@ | ||
repos: | ||
- repo: https://github.com/asottile/pyupgrade | ||
rev: v2.38.0 | ||
hooks: | ||
- id: pyupgrade | ||
args: [ | ||
"--py310-plus" | ||
] | ||
|
||
- repo: https://github.com/psf/black | ||
rev: 22.8.0 | ||
hooks: | ||
- id: black | ||
# It is recommended to specify the latest version of Python | ||
# supported by your project here, or alternatively use | ||
# pre-commit's default_language_version, see | ||
# https://pre-commit.com/#top_level-default_language_version | ||
language_version: python3.10 |
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,23 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="Run main" type="PythonConfigurationType" factoryName="Python"> | ||
<module name="homework__docker__bordovoy_yaroslav" /> | ||
<option name="INTERPRETER_OPTIONS" value="" /> | ||
<option name="PARENT_ENVS" value="true" /> | ||
<envs> | ||
<env name="PYTHONUNBUFFERED" value="1" /> | ||
</envs> | ||
<option name="SDK_HOME" value="" /> | ||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> | ||
<option name="IS_MODULE_SDK" value="true" /> | ||
<option name="ADD_CONTENT_ROOTS" value="true" /> | ||
<option name="ADD_SOURCE_ROOTS" value="true" /> | ||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/main.py" /> | ||
<option name="PARAMETERS" value="" /> | ||
<option name="SHOW_COMMAND_LINE" value="false" /> | ||
<option name="EMULATE_TERMINAL" value="false" /> | ||
<option name="MODULE_MODE" value="false" /> | ||
<option name="REDIRECT_INPUT" value="false" /> | ||
<option name="INPUT_FILE" value="" /> | ||
<method v="2" /> | ||
</configuration> | ||
</component> |
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,25 @@ | ||
FROM python:3.10 | ||
|
||
ENV PYTHONUNBUFFERED=1 | ||
|
||
ARG WORKDIR=/wd | ||
ARG USER=user | ||
|
||
WORKDIR ${WORKDIR} | ||
|
||
RUN useradd --system ${USER} && \ | ||
chown --recursive ${USER} ${WORKDIR} | ||
|
||
RUN apt update && apt upgrade -y | ||
|
||
COPY --chown=${USER} requirements.txt requirements.txt | ||
|
||
RUN pip install --upgrade pip && \ | ||
pip install --requirement requirements.txt | ||
|
||
COPY --chown=${USER} ./main.py main.py | ||
COPY --chown=${USER} ./Makefile Makefile | ||
|
||
USER ${USER} | ||
|
||
ENTRYPOINT ["python", "main.py"] |
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,49 @@ | ||
.PHONY: homework-i-run | ||
# Run homework. | ||
homework-i-run: | ||
@python main.py | ||
|
||
.PHONY: homework-i-purge | ||
homework-i-purge: | ||
@echo The end | ||
|
||
.PHONY: init-dev | ||
# Init environment for development | ||
init-dev: | ||
@pip install --upgrade pip && \ | ||
pip install --requirement requirements.txt && \ | ||
pre-commit install | ||
|
||
.PHONY: pre-commit-run | ||
# Run tools for files from commit. | ||
pre-commit-run: | ||
@pre-commit run | ||
|
||
.PHONY: pre-commit-run-all | ||
# Run tools for all files. | ||
pre-commit-run-all: | ||
@pre-commit run --all-files | ||
|
||
.PHONY: d-homework-i-run | ||
# Make all actions needed for run homework (docker). | ||
d-homework-i-run: | ||
@make d-run | ||
|
||
.PHONY: d-homework-i-purge | ||
# Make all actions needed for purge homework related data. | ||
d-homework-i-purge: | ||
@make d-purge | ||
|
||
.PHONY: d-run | ||
# Run docker | ||
d-run: | ||
@COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 \ | ||
docker-compose \ | ||
up --build | ||
|
||
.PHONY: d-purge | ||
# Purge all data related with services | ||
d-purge: | ||
@COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 \ | ||
docker-compose \ | ||
down --volumes --remove-orphans --rmi local --timeout 0 |
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,28 @@ | ||
# DOCKER HOMEWORK | ||
|
||
--- | ||
|
||
 | ||
|
||
### Important Commands | ||
|
||
|
||
#### ⚡️ Run script | ||
|
||
- make homework-i-run | ||
|
||
#### ❌ Purge script | ||
|
||
- make homework-i-purge | ||
|
||
#### ⚡️ Run docker | ||
|
||
Creating an image. | ||
|
||
- make d-homework-i-run | ||
|
||
#### ❌ Purge docker | ||
|
||
Deleted docker-related data. | ||
|
||
- make d-homework-i-purge |
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,6 @@ | ||
version: '3.8' | ||
|
||
|
||
services: | ||
app: | ||
build: . |
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
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,14 @@ | ||
# Generate fake-names | ||
faker==15.0.0 | ||
|
||
# Autoformatter | ||
black==22.8.0 | ||
|
||
# Check codestyle | ||
flake8==5.0.4 | ||
|
||
# Upgrade syntax | ||
pyupgrade==2.38.2 | ||
|
||
# Pre-commit hook | ||
pre-commit==2.20.0 |