1
1
# Dockerfile for the devcontainer
2
- # Branch: maintain
3
- # Version: 0.1.0
4
- # Tag: alpha
5
-
6
2
# Install
7
3
# - Python 3.12
8
- # - Poetry
9
4
# - Oh My Zsh
10
- # - Pre-commit
5
+ # - Poetry
11
6
12
7
FROM python:3.12-bullseye
13
8
9
+ LABEL organization="ai-data-system-eh"
10
+ LABEL description="Dockerfile for the devcontainer with Python 3.12"
11
+ LABEL tag="alpha"
12
+
14
13
# User configuration
15
14
ARG USER_NAME=user
16
15
ARG USER_UID=1000
17
16
ARG USER_GID=1000
18
- ARG WORKSPACE=/workspace
17
+ ARG WORKSPACE=/workspaces
19
18
20
19
# Keeps Python from generating .pyc files in the container
21
20
ENV PYTHONDONTWRITEBYTECODE=1
@@ -26,88 +25,80 @@ ENV PYTHONUNBUFFERED=1
26
25
ENV DEBIAN_FRONTEND=noninteractive
27
26
28
27
# 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 \
31
29
zsh \
32
30
sudo \
33
31
nano \
34
32
bat \
35
33
locales \
36
- tzdata
34
+ tzdata \
35
+ net-tools
37
36
38
37
RUN apt-get autoremove -y && apt-get clean
39
38
40
39
# Set locale
41
40
ENV LANG=ko_KR.UTF-8
42
41
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
45
44
46
45
# Set timezone
47
46
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
50
48
51
49
WORKDIR ${WORKSPACE}
52
50
53
51
# 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}
56
54
57
55
# 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}
59
57
60
58
# Switch container user to ${USER_NAME}
61
59
USER ${USER_NAME}
62
60
63
61
# Set Zsh as default shell
64
62
RUN sudo chsh -s /bin/zsh ${USER_NAME}
65
- # ENV SHELL= /bin/zsh
63
+ SHELL [ " /bin/zsh" , "-c" ]
66
64
67
65
# Install Oh My Zsh and plugins
68
66
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
80
78
81
79
# Copy .zshrc and .p10k.zsh
82
80
COPY extra/.zshrc /home/${USER_NAME}/.zshrc
81
+ RUN sudo chown ${USER_NAME}:${USER_NAME} /home/${USER_NAME}/.zshrc
83
82
COPY extra/.p10k.zsh /home/${USER_NAME}/.p10k.zsh
83
+ RUN sudo chown ${USER_NAME}:${USER_NAME} /home/${USER_NAME}/.p10k.zsh
84
84
85
85
# 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
88
88
89
89
# 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
92
92
93
93
# Install Poetry
94
- ENV POETRY_HOME=/home/${USER_NAME}/.poetry
95
- ENV PATH="${POETRY_HOME}/bin:${PATH}"
96
94
RUN curl -sSL https://install.python-poetry.org | python3 -
95
+ ENV PATH="/home/${USER_NAME}/.local/bin:${PATH}"
97
96
98
97
# 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
112
103
113
104
CMD [ "/bin/zsh" ]
0 commit comments