Skip to content

Commit

Permalink
feat: adds custom dev container configuration
Browse files Browse the repository at this point in the history
Note that this does not having podman installed and
does not support working on or running the end to end
tests.

Signed-off-by: Jennifer Power <[email protected]>
  • Loading branch information
jpower432 committed Nov 29, 2023
1 parent 3bb6a87 commit 5e843aa
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
FROM quay.io/fedora/fedora:37

ARG POETRY_VERSION=1.5.1

RUN dnf -y update && \
yum -y reinstall shadow-utils && \
yum install -y git \
python3 \
python3-pip \
python3-devel \
gcc-c++ && \
rm -rf /var/cache /var/log/dnf* /var/log/yum.*

RUN useradd -u 1000 trestlebot

ENV HOME=/home/trestlebot
ENV PYSETUP_PATH="$HOME/trestle-bot" \
VENV_PATH="$HOME/trestle-bot/.venv"

RUN mkdir -p "$PYSETUP_PATH"

# Installing poetry and pipx.
RUN python3 -m pip install --no-cache-dir --upgrade pip \
&& python3 -m pip install --no-cache-dir pipx \
&& python3 -m pipx install poetry==$POETRY_VERSION

# set permissions
RUN chown trestlebot:trestlebot -R /home/trestlebot

USER trestlebot
35 changes: 35 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "TrestleBot Dev Environment ",
"build": {
"dockerfile": "Dockerfile",
"context": ".."
},
"customizations": {
"vscode": {
"settings": {
"python.linting.enabled": true,
"python.defaultInterpreterPath": "/home/trestlebot/trestle-bot/.venv/bin/python3"
},
"extensions": [
"ms-python.python",
"ms-python.mypy-type-checker",
"ms-python.flake8",
"ms-python.isort",
"ms-azuretools.vscode-docker"
]
}
},
"updateRemoteUserUID": true,
"containerUser": "trestlebot",
"containerEnv": {
"HOME": "/home/trestlebot",
"PIP_NO_CACHE_DIR": "off",
"PIP_DISABLE_PIP_VERSION_CHECK": "on",
"PIP_DEFAULT_TIMEOUT": "100",
"POETRY_VIRTUALENVS_IN_PROJECT": "true"
},
"updateContentCommand": "python3 -m venv $VENV_PATH && source $VENV_PATH/bin/activate && poetry install --no-root --no-interaction",
"postCreateCommand": "echo \"source $VENV_PATH/bin/activate\" >> $HOME/.bashrc",
"workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind",
"workspaceFolder": "/workspace"
}

0 comments on commit 5e843aa

Please sign in to comment.