Skip to content

Commit ac08938

Browse files
Update tooling
1 parent 50f17d5 commit ac08938

File tree

6 files changed

+76
-17
lines changed

6 files changed

+76
-17
lines changed

.devcontainer/.dockerignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
!poetry.lock
2+
!pyproject.toml
3+
.cache
4+
.devcontainer
5+
.git
6+
.gitignore
7+
.pytest_cache
8+
.tool-versions
9+
.venv
10+
.vscode
11+
**/__pycache__
12+
Dockerfile*
13+
README.md

.devcontainer/Dockerfile

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,12 @@ ENV POETRY_NO_INTERACTION=1
3232
ENV VENV="/opt/venv"
3333
ENV PATH="$POETRY_HOME/bin:$VENV/bin:$PATH"
3434

35+
COPY requirements.txt requirements.txt
36+
3537
RUN python -m venv $VENV \
36-
&& . "${VENV}/bin/activate" \
37-
&& python -m pip install "poetry==${POETRY_VERSION}"
38+
&& . "${VENV}/bin/activate"\
39+
&& python -m pip install "poetry==${POETRY_VERSION}" \
40+
&& python -m pip install -r requirements.txt
3841

3942
FROM python:${PYTHON_VERSION}-slim-bullseye AS runner
4043

@@ -67,20 +70,29 @@ RUN apt -qq update && apt -qq install \
6770
curl \
6871
dpkg \
6972
git \
73+
iputils-ping \
7074
lsof \
7175
p7zip \
7276
perl \
77+
shellcheck \
7378
tldr \
7479
tree \
7580
&& rm -rf /var/lib/apt/lists/*
7681

77-
RUN groupadd ${USER_NAME} \
78-
&& useradd -m ${USER_NAME} -g ${USER_GROUP}
82+
RUN groupadd $USER_NAME \
83+
&& useradd -m $USER_NAME -g $USER_GROUP
84+
85+
# create read/write dirs
86+
RUN <<EOF
87+
#!/usr/bin/env bash
88+
mkdir -p /app/{certs,staticfiles}
89+
chown -R "${USER_NAME}:${USER_GROUP}" /app/
90+
EOF
7991

8092
USER $USER_NAME
8193
WORKDIR $HOME
8294

83-
COPY --from=builder --chown=nonroot:nonroot $VENV $VENV
95+
COPY --from=builder --chown=${USER_NAME}:${USER_GROUP} $VENV $VENV
8496

8597
# qol: tooling
8698
RUN <<EOF
@@ -99,7 +111,7 @@ yes | ~/.fzf/install
99111
EOF
100112

101113
# qol: .bashrc
102-
RUN <<EOF tee -a $HOME/.bashrc
114+
RUN tee -a $HOME/.bashrc <<EOF
103115
# shared history
104116
HISTFILE=/var/tmp/.bash_history
105117
HISTFILESIZE=100
@@ -118,4 +130,7 @@ EOF
118130
# $PATH
119131
ENV PATH=$VENV_PATH/bin:$HOME/.local/bin:$PATH
120132

133+
# port needed by app
134+
EXPOSE 8000
135+
121136
CMD ["sleep", "infinity"]

.devcontainer/devcontainer.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
11
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
22
// README at: https://github.com/devcontainers/templates/tree/main/src/python
33
{
4-
"name": "Python 3",
4+
"name": "Dev Environment",
55
"build": {
66
"dockerfile": "Dockerfile"
77
},
88
"customizations": {
99
"vscode": {
1010
"extensions": [
1111
"aaron-bond.better-comments",
12-
"bradlc.vscode-tailwindcss",
12+
"codezombiech.gitignore",
1313
"eamodio.gitlens",
1414
"EditorConfig.EditorConfig",
1515
"GitHub.copilot-chat",
1616
"GitHub.copilot",
17-
"hashicorp.terraform",
17+
"mads-hartmann.bash-ide-vscode",
1818
"ms-azuretools.vscode-docker",
1919
"ms-python.python",
2020
"ms-vscode.atom-keybindings",
21-
"ms-vscode.live-server",
2221
"ms-vsliveshare.vsliveshare",
2322
"redhat.vscode-yaml",
24-
"streetsidesoftware.code-spell-checker"
23+
"timonwong.shellcheck",
24+
"yzhang.markdown-all-in-one"
2525
]
2626
}
2727
},
28-
"forwardPorts": [
29-
8080,
30-
8081
31-
]
28+
// "forwardPorts": [
29+
// 8080,
30+
// 8081
31+
// ]
3232
}

.devcontainer/requirements.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
asttokens==2.2.1
2+
backcall==0.2.0
3+
decorator==5.1.1
4+
executing==1.2.0
5+
ipython==8.14.0
6+
jedi==0.19.0
7+
markdown-it-py==3.0.0
8+
matplotlib-inline==0.1.6
9+
mdurl==0.1.2
10+
parso==0.8.3
11+
pexpect==4.8.0
12+
pickleshare==0.7.5
13+
prompt-toolkit==3.0.39
14+
ptyprocess==0.7.0
15+
pure-eval==0.2.2
16+
Pygments==2.16.1
17+
rich==13.5.2
18+
six==1.16.0
19+
stack-data==0.6.2
20+
traitlets==5.9.0
21+
wcwidth==0.2.6

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
**/raw/
99
gitleaks_report*.json
1010
redis.conf
11+
.ruff*
1112

1213
# Byte-compiled / optimized / DLL files
1314
__pycache__/

.vscode/settings.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
{
2-
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
3-
"python.terminal.activateEnvInCurrentTerminal": true,
2+
"[python]": {
3+
"editor.insertSpaces": true,
4+
"editor.tabSize": 4,
5+
},
6+
"python.testing.pytestArgs": [
7+
"."
8+
],
9+
// https://github.com/astral-sh/ruff-vscode
10+
"python.analysis.ignore": [
11+
"*"
12+
],
413
}

0 commit comments

Comments
 (0)