Skip to content

Commit d7a0dd0

Browse files
committed
update poetry & p10k
1 parent 1951bdc commit d7a0dd0

File tree

7 files changed

+399
-480
lines changed

7 files changed

+399
-480
lines changed

.devcontainer/Dockerfile

Lines changed: 39 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
# Dockerfile for the devcontainer
2-
# Branch: maintain
3-
# Version: 0.1.0
4-
# Tag: alpha
5-
62
# Install
73
# - Python 3.12
8-
# - Poetry
94
# - Oh My Zsh
10-
# - Pre-commit
5+
# - Poetry
116

127
FROM python:3.12-bullseye
138

9+
LABEL organization="ai-data-system-eh"
10+
LABEL description="Dockerfile for the devcontainer with Python 3.12"
11+
LABEL tag="alpha"
12+
1413
# User configuration
1514
ARG USER_NAME=user
1615
ARG USER_UID=1000
1716
ARG USER_GID=1000
18-
ARG WORKSPACE=/workspace
17+
ARG WORKSPACE=/workspaces
1918

2019
# Keeps Python from generating .pyc files in the container
2120
ENV PYTHONDONTWRITEBYTECODE=1
@@ -26,88 +25,80 @@ ENV PYTHONUNBUFFERED=1
2625
ENV DEBIAN_FRONTEND=noninteractive
2726

2827
# Configure apt and install packages
29-
RUN apt-get update \
30-
&& apt-get -y install --no-install-recommends \
28+
RUN apt-get update && apt-get -y install --no-install-recommends \
3129
zsh \
3230
sudo \
3331
nano \
3432
bat \
3533
locales \
36-
tzdata
34+
tzdata \
35+
net-tools
3736

3837
RUN apt-get autoremove -y && apt-get clean
3938

4039
# Set locale
4140
ENV LANG=ko_KR.UTF-8
4241
ENV LC_MESSAGES=POSIX
43-
RUN localedef -i ko_KR -c -f UTF-8 -A /usr/share/locale/locale.alias ko_KR.UTF-8 \
44-
&& update-locale LANG=$LANG LC_MESSAGES=$LC_MESSAGES
42+
RUN localedef -i ko_KR -c -f UTF-8 -A /usr/share/locale/locale.alias ko_KR.UTF-8 && \
43+
update-locale LANG=$LANG LC_MESSAGES=$LC_MESSAGES
4544

4645
# Set timezone
4746
ENV TZ=Asia/Seoul
48-
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
49-
47+
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ >/etc/timezone
5048

5149
WORKDIR ${WORKSPACE}
5250

5351
# For more info, please refer to https://aka.ms/vscode-docker-python-configure-containers
54-
RUN adduser --disabled-password --gecos "" --uid ${USER_UID} ${USER_NAME} \
55-
&& chown -R ${USER_NAME} ${WORKSPACE}
52+
RUN adduser --disabled-password --gecos "" --uid ${USER_UID} ${USER_NAME} && \
53+
chown -R ${USER_NAME} ${WORKSPACE}
5654

5755
# Grant sudo privilege to ${USER_NAME}
58-
RUN echo "${USER_NAME} ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/${USER_NAME}
56+
RUN echo "${USER_NAME} ALL=(ALL) NOPASSWD:ALL" >/etc/sudoers.d/${USER_NAME}
5957

6058
# Switch container user to ${USER_NAME}
6159
USER ${USER_NAME}
6260

6361
# Set Zsh as default shell
6462
RUN sudo chsh -s /bin/zsh ${USER_NAME}
65-
# ENV SHELL=/bin/zsh
63+
SHELL [ "/bin/zsh", "-c" ]
6664

6765
# Install Oh My Zsh and plugins
6866
ENV ZSH_CUSTOM=/home/${USER_NAME}/.oh-my-zsh/custom
69-
RUN sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" \
70-
&& git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions \
71-
&& git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting \
72-
&& git clone https://github.com/zdharma-continuum/fast-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/fast-syntax-highlighting \
73-
&& git clone https://github.com/zsh-users/zsh-completions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-completions \
74-
&& git clone https://github.com/zsh-users/zsh-history-substring-search ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-history-substring-search \
75-
&& git clone https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/themes/powerlevel10k \
76-
&& git clone https://github.com/mattmc3/zsh-safe-rm ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-safe-rm \
77-
&& git clone https://github.com/fdellwing/zsh-bat.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-bat \
78-
&& git clone https://github.com/gretzky/auto-color-ls ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/auto-color-ls \
79-
&& git clone https://github.com/TamCore/autoupdate-oh-my-zsh-plugins ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/autoupdate
67+
RUN sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" && \
68+
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions && \
69+
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting && \
70+
git clone https://github.com/zdharma-continuum/fast-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/fast-syntax-highlighting && \
71+
git clone https://github.com/zsh-users/zsh-completions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-completions && \
72+
git clone https://github.com/zsh-users/zsh-history-substring-search ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-history-substring-search && \
73+
git clone https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/themes/powerlevel10k && \
74+
git clone https://github.com/mattmc3/zsh-safe-rm ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-safe-rm && \
75+
git clone https://github.com/fdellwing/zsh-bat.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-bat && \
76+
git clone https://github.com/gretzky/auto-color-ls ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/auto-color-ls && \
77+
git clone https://github.com/TamCore/autoupdate-oh-my-zsh-plugins ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/autoupdate
8078

8179
# Copy .zshrc and .p10k.zsh
8280
COPY extra/.zshrc /home/${USER_NAME}/.zshrc
81+
RUN sudo chown ${USER_NAME}:${USER_NAME} /home/${USER_NAME}/.zshrc
8382
COPY extra/.p10k.zsh /home/${USER_NAME}/.p10k.zsh
83+
RUN sudo chown ${USER_NAME}:${USER_NAME} /home/${USER_NAME}/.p10k.zsh
8484

8585
# Install fzf
86-
RUN git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf \
87-
&& ~/.fzf/install --all --no-fish
86+
RUN git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf && \
87+
~/.fzf/install --all --no-fish
8888

8989
# Install Ruby gem for colorls
90-
RUN sudo apt-get -y install --no-install-recommends ruby-dev \
91-
&& sudo gem install colorls
90+
RUN sudo apt-get -y install --no-install-recommends ruby-dev && \
91+
sudo gem install colorls
9292

9393
# Install Poetry
94-
ENV POETRY_HOME=/home/${USER_NAME}/.poetry
95-
ENV PATH="${POETRY_HOME}/bin:${PATH}"
9694
RUN curl -sSL https://install.python-poetry.org | python3 -
95+
ENV PATH="/home/${USER_NAME}/.local/bin:${PATH}"
9796

9897
# Configure Poetry
99-
RUN mkdir -p ${ZSH_CUSTOM}/plugins/poetry \
100-
&& poetry completions zsh > ${ZSH_CUSTOM}/plugins/poetry/_poetry \
101-
&& poetry config virtualenvs.create true \
102-
&& poetry config virtualenvs.in-project true \
103-
&& poetry config virtualenvs.path .venv \
104-
&& poetry self update
105-
106-
# Install pre-commit
107-
RUN pip install pre-commit
108-
109-
# Install pip requirements
110-
# COPY requirements.txt .
111-
# RUN python -m pip install -r requirements.txt
98+
RUN mkdir -p ${ZSH_CUSTOM}/plugins/poetry && \
99+
poetry completions zsh >${ZSH_CUSTOM}/plugins/poetry/_poetry && \
100+
poetry config virtualenvs.create true && \
101+
poetry config virtualenvs.in-project true && \
102+
poetry config virtualenvs.path .venv
112103

113104
CMD [ "/bin/zsh" ]

.devcontainer/devcontainer.json

Lines changed: 26 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,33 @@
1-
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2-
// README at: https://github.com/devcontainers/templates/tree/main/src/python
31
{
4-
"name": "Python 3",
5-
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6-
// "image": "mcr.microsoft.com/devcontainers/python:1-3.12-bullseye",
7-
// "image": "ghcr.io/ai-data-system-eh/python-devcontainer:alpha",
8-
// "dockerComposeFile": "docker-compose.yml",
9-
// "service": "devcontainer",
10-
"build": {
11-
"dockerfile": "Dockerfile"
12-
},
13-
"workspaceFolder": "/workspace/${localWorkspaceFolderBasename}",
14-
"workspaceMount": "source=${localWorkspaceFolder},target=/workspace/${localWorkspaceFolderBasename},type=bind,consistency=cached",
15-
16-
// prettier-ignore
2+
"name": "Python3.12",
3+
"image": "ghcr.io/ai-data-system-eh/python-devcontainer:alpha",
4+
// "build": {
5+
// "dockerfile": "Dockerfile"
6+
// },
177
"runArgs": [
18-
"--name", "${localEnv:USER}-${localWorkspaceFolderBasename}",
19-
"--hostname", "${localEnv:USER}-${localWorkspaceFolderBasename}",
20-
// "--user", "${localEnv:USER}",
21-
"--workdir", "/workspace/${localWorkspaceFolderBasename}"
8+
"--name",
9+
"${localEnv:USER}-${localWorkspaceFolderBasename}"
2210
],
2311

24-
"containerEnv": {
25-
"TZ": "Asia/Seoul",
26-
"LANG": "ko_KR.UTF-8",
27-
"LC_MESSAGES": "POSIX"
28-
}
12+
"postCreateCommand": "poetry install",
2913

3014
// Configure tool-specific properties.
31-
// "customizations": {
32-
// "vscode": {
33-
// "extensions": [
34-
// "ms-python.python",
35-
// "ms-python.vscode-python-envs",
36-
// "charliermarsh.ruff",
37-
// "esbenp.prettier-vscode",
38-
// "tamasfe.even-better-toml",
39-
// "redhat.vscode-yaml",
40-
// "foxundermoon.shell-format",
41-
// "mhutchie.git-graph",
42-
// "codezombiech.gitignore",
43-
// "bierner.github-markdown-preview",
44-
// "yzhang.markdown-all-in-one",
45-
// "DavidAnson.vscode-markdownlint",
46-
// "natqe.reload",
47-
// "mutantdino.resourcemonitor",
48-
// "jerrygoyal.shortcut-menu-bar"
49-
// ]
50-
// }
51-
// }
52-
53-
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
54-
// "remoteUser": "root"
15+
"customizations": {
16+
"vscode": {
17+
"extensions": [
18+
"ms-python.python",
19+
"ms-python.vscode-python-envs",
20+
"charliermarsh.ruff",
21+
"esbenp.prettier-vscode",
22+
"tamasfe.even-better-toml",
23+
"redhat.vscode-yaml",
24+
"foxundermoon.shell-format",
25+
"mhutchie.git-graph",
26+
"codezombiech.gitignore",
27+
"bierner.github-markdown-preview",
28+
"yzhang.markdown-all-in-one",
29+
"DavidAnson.vscode-markdownlint"
30+
]
31+
}
32+
}
5533
}

0 commit comments

Comments
 (0)