-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #712 from robbrad/dev_container
Dev container
- Loading branch information
Showing
12 changed files
with
701 additions
and
395 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,41 @@ | ||
ARG VARIANT="3.11-bullseye" | ||
FROM mcr.microsoft.com/devcontainers/python:${VARIANT} AS ukbc-dev-base | ||
|
||
USER vscode | ||
|
||
# Define the version of Poetry to install (default is 1.4.2) | ||
# Define the directory of python virtual environment | ||
ARG PYTHON_VIRTUALENV_HOME=/home/vscode/ukbc-py-env \ | ||
POETRY_VERSION=1.5.1 | ||
|
||
ENV POETRY_VIRTUALENVS_IN_PROJECT=false \ | ||
POETRY_NO_INTERACTION=true | ||
|
||
# Install Poetry outside of the v`irtual environment to avoid conflicts | ||
RUN python3 -m pip install --user pipx && \ | ||
python3 -m pipx ensurepath && \ | ||
pipx install poetry==${POETRY_VERSION} | ||
|
||
# Create a Python virtual environment for the project | ||
RUN python3 -m venv ${PYTHON_VIRTUALENV_HOME} && \ | ||
$PYTHON_VIRTUALENV_HOME/bin/pip install --upgrade pip | ||
|
||
ENV PATH="$PYTHON_VIRTUALENV_HOME/bin:$PATH" \ | ||
VIRTUAL_ENV=$PYTHON_VIRTUALENV_HOME | ||
|
||
# Setup for bash | ||
RUN poetry completions bash >> /home/vscode/.bash_completion && \ | ||
echo "export PATH=$PYTHON_VIRTUALENV_HOME/bin:$PATH" >> ~/.bashrc | ||
|
||
# Set the working directory for the app | ||
WORKDIR /ukbc_build | ||
|
||
# Use a multi-stage build to install dependencies | ||
FROM ukbc-dev-base AS ukbc-dev-dependencies | ||
|
||
ARG PYTHON_VIRTUALENV_HOME | ||
|
||
COPY . /ukbc_build/ | ||
|
||
RUN poetry install --no-interaction --no-ansi --with dev | ||
#docker build -f .devcontainer/dev.Dockerfile -t ukbc_dev_container . |
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,71 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the | ||
// README at: https://github.com/devcontainers/templates/tree/main/src/python | ||
{ | ||
"dockerComposeFile": "docker-compose.yml", | ||
"service": "devcontainer", | ||
"workspaceFolder": "/workspaces/UKBinCollectionData", | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"ms-python.python", | ||
"ms-python.vscode-pylance", | ||
"eamodio.gitlens", | ||
"ms-python.black-formatter", | ||
"ms-python.isort", | ||
"ms-python.python", | ||
"ryanluker.vscode-coverage-gutters", | ||
"Gruntfuggly.todo-tree", | ||
"oderwat.indent-rainbow", | ||
"yzhang.markdown-all-in-one", | ||
"alexkrechik.cucumberautocomplete" | ||
], | ||
"settings": { | ||
"makefile.makefilePath": "${workspaceFolder}/", | ||
"files.exclude": { | ||
"**/__pycache__": true, | ||
"**/.pytest_cache": true | ||
}, | ||
"autoSave": true, | ||
"git.autorefresh": true, | ||
"extensions.ignoreRecommendations": true, | ||
"isort.args": [ | ||
"--profile", | ||
"black" | ||
], | ||
"python.analysis.diagnosticMode": "workspace", | ||
"python.analysis.typeCheckingMode": "strict", | ||
"python.analysis.logLevel": "Trace", | ||
"python.analysis.disableSemanticOnNoPython": false, | ||
"python.analysis.enableSyncServer": true, | ||
"python.analysis.userFileIndexingLimit": -1, | ||
"python.formatting.provider": "none", | ||
"python.languageServer": "Pylance", | ||
"python.linting.enabled": false, | ||
"python.linting.lintOnSave": false, | ||
"python.testing.autoTestDiscoverOnSaveEnabled": false, | ||
"python.defaultInterpreterPath": "/home/vscode/ukbc-py-env", | ||
"python.testing.pytestArgs": [ | ||
"${workspaceFolder}/uk_bin_collection", | ||
"--headless=False", | ||
"-o cache_dir=${workspaceFolder}/.pytest_cache" | ||
], | ||
"python.testing.unittestEnabled": false, | ||
"python.testing.pytestEnabled": true, | ||
"[python]": { | ||
"editor.defaultFormatter": "ms-python.black-formatter", | ||
"editor.formatOnSave": true, | ||
"editor.formatOnPaste": false, | ||
"editor.formatOnSaveMode": "file", | ||
"editor.codeActionsOnSave": { | ||
"source.organizeImports": true | ||
} | ||
}, | ||
"workbench.colorCustomizations": { | ||
"editorError.foreground": "#ff000088", | ||
"editorWarning.foreground": "#ffe60033", | ||
"editorInfo.foreground": "#00ff0088" | ||
} | ||
} | ||
} | ||
} | ||
} |
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,63 @@ | ||
services: | ||
devcontainer: | ||
image: ukbc_dev_container # This tags the built image | ||
build: | ||
context: ../ # Path to the directory containing the Dockerfile | ||
dockerfile: .devcontainer/dev.Dockerfile | ||
volumes: | ||
- ../:/workspaces/UKBinCollectionData:rw | ||
privileged: true | ||
hostname: devcontainer | ||
network_mode: host | ||
depends_on: | ||
- selenium-hub | ||
command: sleep infinity | ||
|
||
chrome: | ||
image: selenium/node-chrome:4.20.0-20240505 | ||
shm_size: 2gb | ||
networks: | ||
- devnet | ||
depends_on: | ||
- selenium-hub | ||
ports: | ||
- "7900:7900" | ||
- "5555:5555" | ||
environment: | ||
- SE_EVENT_BUS_HOST=selenium-hub | ||
- SE_EVENT_BUS_PUBLISH_PORT=4442 | ||
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443 | ||
privileged: true | ||
restart: always | ||
|
||
chrome_video: | ||
image: selenium/video:ffmpeg-6.1.1-20240505 | ||
networks: | ||
- devnet | ||
volumes: | ||
- ../test_videos:/videos/ | ||
depends_on: | ||
- chrome | ||
environment: | ||
- DISPLAY_CONTAINER_NAME=chrome | ||
- SE_VIDEO_FILE_NAME=auto | ||
- SE_NODE_GRID_URL=http://selenium-hub:4444 | ||
privileged: true | ||
restart: always | ||
|
||
selenium-hub: | ||
image: selenium/hub:4.20.0-20240505 | ||
container_name: selenium-hub | ||
hostname: selenium | ||
ports: | ||
- "4442:4442" | ||
- "4443:4443" | ||
- "4444:4444" | ||
privileged: true | ||
restart: always | ||
networks: | ||
- devnet | ||
|
||
networks: | ||
devnet: | ||
driver: bridge |
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,38 @@ | ||
# Ignore everything | ||
* | ||
|
||
# But not these files... | ||
!*.json | ||
!*.py | ||
!PipFile | ||
!Pipfile.lock | ||
!.gitignore | ||
!.dockerignore | ||
!*.toml | ||
!*.md | ||
!*.rst | ||
!LICENSE | ||
!*.schema | ||
!Makefile | ||
!dependabot.yaml | ||
!poetry.lock | ||
!behave.ini | ||
!*.Dockerfile | ||
|
||
# Or these folders... | ||
!.github | ||
!*.png | ||
!.github/ISSUE_TEMPLATE | ||
!.github/ISSUE_TEMPLATE/*.yaml | ||
!.github/workflows | ||
!.github/workflows/*.yml | ||
!uk_bin_collection | ||
!uk_bin_collection/**/* | ||
!uk_bin_collection_api_server | ||
!uk_bin_collection_api_server/**/* | ||
!wiki | ||
!wiki/**/* | ||
!custom_components | ||
__pycache__ | ||
!TO_BE_CONVERTED | ||
!.devcontainer |
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
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 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Python Debugger: Current File", | ||
"type": "debugpy", | ||
"request": "launch", | ||
"purpose": ["debug-test"], | ||
"env": { | ||
"PYTEST_ADDOPTS": "--headless=False --local_browser=False" | ||
} | ||
} | ||
] | ||
} |
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
Oops, something went wrong.