Skip to content

Commit 1951bdc

Browse files
committed
Initial Commit
0 parents  commit 1951bdc

File tree

7 files changed

+1771
-0
lines changed

7 files changed

+1771
-0
lines changed

.devcontainer/Dockerfile

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# Dockerfile for the devcontainer
2+
# Branch: maintain
3+
# Version: 0.1.0
4+
# Tag: alpha
5+
6+
# Install
7+
# - Python 3.12
8+
# - Poetry
9+
# - Oh My Zsh
10+
# - Pre-commit
11+
12+
FROM python:3.12-bullseye
13+
14+
# User configuration
15+
ARG USER_NAME=user
16+
ARG USER_UID=1000
17+
ARG USER_GID=1000
18+
ARG WORKSPACE=/workspace
19+
20+
# Keeps Python from generating .pyc files in the container
21+
ENV PYTHONDONTWRITEBYTECODE=1
22+
# Turns off buffering for easier container logging
23+
ENV PYTHONUNBUFFERED=1
24+
25+
# Avoid warnings by switching to noninteractive
26+
ENV DEBIAN_FRONTEND=noninteractive
27+
28+
# Configure apt and install packages
29+
RUN apt-get update \
30+
&& apt-get -y install --no-install-recommends \
31+
zsh \
32+
sudo \
33+
nano \
34+
bat \
35+
locales \
36+
tzdata
37+
38+
RUN apt-get autoremove -y && apt-get clean
39+
40+
# Set locale
41+
ENV LANG=ko_KR.UTF-8
42+
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
45+
46+
# Set timezone
47+
ENV TZ=Asia/Seoul
48+
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
49+
50+
51+
WORKDIR ${WORKSPACE}
52+
53+
# 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}
56+
57+
# Grant sudo privilege to ${USER_NAME}
58+
RUN echo "${USER_NAME} ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/${USER_NAME}
59+
60+
# Switch container user to ${USER_NAME}
61+
USER ${USER_NAME}
62+
63+
# Set Zsh as default shell
64+
RUN sudo chsh -s /bin/zsh ${USER_NAME}
65+
# ENV SHELL=/bin/zsh
66+
67+
# Install Oh My Zsh and plugins
68+
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
80+
81+
# Copy .zshrc and .p10k.zsh
82+
COPY extra/.zshrc /home/${USER_NAME}/.zshrc
83+
COPY extra/.p10k.zsh /home/${USER_NAME}/.p10k.zsh
84+
85+
# Install fzf
86+
RUN git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf \
87+
&& ~/.fzf/install --all --no-fish
88+
89+
# Install Ruby gem for colorls
90+
RUN sudo apt-get -y install --no-install-recommends ruby-dev \
91+
&& sudo gem install colorls
92+
93+
# Install Poetry
94+
ENV POETRY_HOME=/home/${USER_NAME}/.poetry
95+
ENV PATH="${POETRY_HOME}/bin:${PATH}"
96+
RUN curl -sSL https://install.python-poetry.org | python3 -
97+
98+
# 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
112+
113+
CMD [ "/bin/zsh" ]

.devcontainer/devcontainer.json

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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
3+
{
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
17+
"runArgs": [
18+
"--name", "${localEnv:USER}-${localWorkspaceFolderBasename}",
19+
"--hostname", "${localEnv:USER}-${localWorkspaceFolderBasename}",
20+
// "--user", "${localEnv:USER}",
21+
"--workdir", "/workspace/${localWorkspaceFolderBasename}"
22+
],
23+
24+
"containerEnv": {
25+
"TZ": "Asia/Seoul",
26+
"LANG": "ko_KR.UTF-8",
27+
"LC_MESSAGES": "POSIX"
28+
}
29+
30+
// 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"
55+
}

0 commit comments

Comments
 (0)