Skip to content

Commit 4124945

Browse files
ulken94Haneol Kim
andauthored
Upgrade version of docker and python requirements (#11)
* Upgrade version of docker and python requirements * Fix to github action runs on latest ubuntu version * Specify python version of conda env * Fix requirements version for formatting and linting * Fix requirements version for formatting and linting * Fix requirements version for formatting and linting * aarch64 does not support neo-vim yet --------- Co-authored-by: Haneol Kim <hekim@jmarple.ai>
1 parent 636a62b commit 4124945

6 files changed

Lines changed: 100 additions & 55 deletions

File tree

.github/workflows/format-lint-unittest.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66

77
jobs:
88
format-lint-unittest:
9-
runs-on: ubuntu-18.04
9+
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@v2.3.4
1212
- uses: conda-incubator/setup-miniconda@v2

docker/Dockerfile

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
FROM ubuntu:jammy
2+
3+
LABEL maintainer="Jongkuk Lim <limjk@jmarple.ai>, Haneol Kim <hekim@jmarple.ai>"
4+
ENV DEBIAN_FRONTEND=noninteractive
5+
ENV TZ=Asia/Seoul
6+
7+
ARG UID=1000
8+
ARG GID=1000
9+
RUN groupadd -g $GID -o user && useradd -m -u $UID -g $GID -o -s /bin/bash user
10+
11+
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
12+
RUN apt-get update && apt-get install -y sudo dialog apt-utils tzdata
13+
RUN echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && echo "user:user" | chpasswd && adduser user sudo
14+
15+
WORKDIR /home/user
16+
USER user
17+
18+
# Install Display dependencies
19+
RUN sudo apt-get update && sudo apt-get install -y libgl1-mesa-dev && sudo apt-get -y install jq
20+
21+
ENV NVIDIA_VISIBLE_DEVICES ${NVIDIA_VISIBLE_DEVICES:-all}
22+
ENV NVIDIA_DRIVER_CAPABILITIES ${NVIDIA_DRIVER_CAPABILITIES:+$NVIDIA_DRIVER_CAPABILITIES,}graphics
23+
24+
RUN sudo apt-get update && sudo apt-get -y install wget curl git
25+
RUN curl -s https://raw.githubusercontent.com/JeiKeiLim/my_term/main/run.sh | /bin/bash
26+
27+
# install zsh & set theme powerlevel10k
28+
RUN sudo apt-get update && sudo apt-get install -y zsh && \
29+
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended && \
30+
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
31+
RUN echo "\n# Custom settings" >> /home/user/.zshrc && \
32+
echo "export PATH=/home/user/.local/bin:$PATH" >> /home/user/.zshrc && \
33+
echo "export LC_ALL=C.UTF-8 && export LANG=C.UTF-8" >> /home/user/.zshrc && \
34+
sed '11 c\ZSH_THEME=powerlevel10k/powerlevel10k' ~/.zshrc > tmp.txt && mv tmp.txt ~/.zshrc && \
35+
echo 'POWERLEVEL9K_DISABLE_CONFIGURATION_WIZARD=true' >> ~/.zshrc
36+
RUN sudo chsh -s $(which zsh) $(whoami)
37+
38+
# Install python3
39+
RUN sudo apt-get update && sudo apt-get install software-properties-common git -y
40+
RUN sudo apt-get update && sudo apt-get upgrade -y
41+
RUN sudo apt-get install -y python3-pip python3-dev
42+
RUN sudo ln -s /usr/bin/python3 /usr/bin/python
43+
44+
# Install cmake 3.21.0 version.
45+
RUN wget -q https://github.com/Kitware/CMake/releases/download/v3.21.0/cmake-3.21.0-linux-x86_64.tar.gz \
46+
&& tar -xzvf cmake-3.21.0-linux-x86_64.tar.gz \
47+
&& sudo ln -s /home/user/cmake-3.21.0-linux-x86_64/bin/cmake /usr/bin/cmake \
48+
&& sudo ln -s /home/user/root/cmake-3.21.0-linux-x86_64/bin/ctest /usr/bin/ctest \
49+
&& sudo ln -s /home/user/root/cmake-3.21.0-linux-x86_64/bin/cpack /usr/bin/cpack \
50+
&& rm cmake-3.21.0-linux-x86_64.tar.gz
51+
52+
COPY ./requirements.txt ./
53+
COPY ./requirements-dev.txt ./
54+
RUN python -m pip install -r requirements.txt && python -m pip install -r requirements-dev.txt
55+
RUN rm requirements.txt requirements-dev.txt
56+
57+
# Add PATH
58+
RUN echo "export PATH=/home/user/.local/bin:\$PATH" >> /home/user/.bashrc
59+
RUN echo "export LC_ALL=C.UTF-8 && export LANG=C.UTF-8" >> /home/user/.bashrc
60+
61+
# Place your environment here
Lines changed: 22 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
FROM ubuntu:bionic
1+
FROM ubuntu:jammy
22

3-
LABEL maintainer="Jongkuk Lim <limjk@jmarple.ai>"
3+
LABEL maintainer="Jongkuk Lim <limjk@jmarple.ai>, Haneol Kim <hekim@jmarple.ai>"
44
ENV DEBIAN_FRONTEND=noninteractive
55
ENV TZ=Asia/Seoul
66

@@ -18,24 +18,27 @@ USER user
1818
# Install Display dependencies
1919
RUN sudo apt-get update && sudo apt-get install -y libgl1-mesa-dev && sudo apt-get -y install jq
2020

21-
# Install python3.8
22-
RUN sudo apt-get update && sudo apt-get install software-properties-common git -y
23-
RUN sudo add-apt-repository ppa:deadsnakes/ppa && sudo apt-get install python3.8 python3.8-dev python3-distutils curl -y
24-
RUN sudo ln -s /usr/bin/pip3 /usr/bin/pip && \
25-
sudo ln -s /usr/bin/python3.8 /usr/bin/python
26-
RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && python get-pip.py --force-reinstall && python -m pip install --upgrade pip && rm get-pip.py
21+
ENV NVIDIA_VISIBLE_DEVICES ${NVIDIA_VISIBLE_DEVICES:-all}
22+
ENV NVIDIA_DRIVER_CAPABILITIES ${NVIDIA_DRIVER_CAPABILITIES:+$NVIDIA_DRIVER_CAPABILITIES,}graphics
2723

28-
# Terminal environment
29-
RUN git clone https://github.com/JeiKeiLim/my_term.git \
30-
&& cd my_term \
31-
&& ./run.sh
24+
RUN sudo apt-get update && sudo apt-get -y install wget curl git
25+
RUN curl -s https://raw.githubusercontent.com/JeiKeiLim/my_term/main/run.sh | /bin/bash -s -- -vim vim
3226

33-
# Install vim 8.2 with YCM
34-
RUN sudo apt-get install -y software-properties-common \
35-
&& sudo add-apt-repository ppa:jonathonf/vim \
36-
&& sudo add-apt-repository ppa:ubuntu-toolchain-r/test \
37-
&& sudo apt-get update \
38-
&& sudo apt-get install -y vim g++-8 libstdc++6 cmake wget
27+
# install zsh & set theme powerlevel10k
28+
RUN sudo apt-get update && sudo apt-get install -y zsh && \
29+
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended && \
30+
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
31+
RUN echo "\n# Custom settings" >> /home/user/.zshrc && \
32+
echo "export PATH=/home/user/.local/bin:$PATH" >> /home/user/.zshrc && \
33+
echo "export LC_ALL=C.UTF-8 && export LANG=C.UTF-8" >> /home/user/.zshrc && \
34+
sed '11 c\ZSH_THEME=powerlevel10k/powerlevel10k' ~/.zshrc > tmp.txt && mv tmp.txt ~/.zshrc && \
35+
echo 'POWERLEVEL9K_DISABLE_CONFIGURATION_WIZARD=true' >> ~/.zshrc
36+
RUN sudo chsh -s $(which zsh) $(whoami)
37+
38+
# Install python3
39+
RUN sudo apt-get update && sudo apt-get install software-properties-common git -y
40+
RUN sudo apt-get update && sudo apt-get upgrade -y
41+
RUN sudo apt-get install -y python3-pip python3-dev
3942

4043
# Install cmake 3.21.0 version.
4144
RUN wget -q https://github.com/Kitware/CMake/releases/download/v3.21.0/cmake-3.21.0-linux-x86_64.tar.gz \
@@ -48,14 +51,6 @@ RUN wget -q https://github.com/Kitware/CMake/releases/download/v3.21.0/cmake-3.2
4851
&& sudo ln -s /home/user/root/cmake-3.21.0-linux-x86_64/bin/cpack /usr/bin/cpack \
4952
&& rm cmake-3.21.0-linux-x86_64.tar.gz
5053

51-
RUN cd /home/user/.vim_runtime/my_plugins \
52-
&& git clone --recursive https://github.com/ycm-core/YouCompleteMe.git \
53-
&& cd YouCompleteMe \
54-
&& CC=gcc-8 CXX=g++-8 python install.py --clangd-completer
55-
56-
# Fix error messages with vim plugins
57-
RUN cd /home/user/.vim_runtime/sources_non_forked && rm -rf tlib vim-fugitive && git clone https://github.com/tomtom/tlib_vim.git tlib && git clone https://github.com/tpope/vim-fugitive.git
58-
5954
COPY ./requirements.txt ./
6055
COPY ./requirements-dev.txt ./
6156
RUN python -m pip install -r requirements.txt && python -m pip install -r requirements-dev.txt
@@ -65,19 +60,4 @@ RUN rm requirements.txt requirements-dev.txt
6560
RUN echo "export PATH=/home/user/.local/bin:\$PATH" >> /home/user/.bashrc
6661
RUN echo "export LC_ALL=C.UTF-8 && export LANG=C.UTF-8" >> /home/user/.bashrc
6762

68-
# Install zsh with powerlevel10k theme
69-
ARG USE_ZSH=true
70-
71-
RUN sudo apt-get install -y zsh && \
72-
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended && \
73-
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
74-
COPY res/.zshrc res/.p10k.zsh /home/user/
75-
RUN sudo chown user:user .zshrc .p10k.zsh
76-
77-
RUN if [ "$USE_ZSH" = "true" ]; then \
78-
sudo chsh -s $(which zsh) $(whoami) && \
79-
echo "\n# Custom settings" >> /home/user/.zshrc && \
80-
echo "export PATH=/home/user/.local/bin:\$PATH" >> /home/user/.zshrc && \
81-
echo "export LC_ALL=C.UTF-8 && export LANG=C.UTF-8" >> /home/user/.zshrc; \
82-
fi
83-
63+
# Place your environment here

environment.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,12 @@ name: python_template
33
channels:
44
- conda-forge
55
- defaults
6-
- pytorch
76

87
dependencies:
9-
- python=3.8 # Change python version if necessary
8+
- python=3.10 # Change python version if necessary
109
- pip
1110
# Place your conda dependencies here
1211
- pip:
1312
# Place your pip dependencies in requirements.txt
1413
- -r requirements.txt
1514
- -r requirements-dev.txt
16-

requirements-dev.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
black==19.10b0
1+
black==23.7.0
22
coverage==5.3
3-
flake8==3.8.3
3+
flake8==4.0.1
44
flake8-bugbear==20.1.4
55
flake8-docstrings==1.5.0
66
isort==5.5.3
77
mypy==0.782
88
pre-commit==2.7.1
9-
pyflakes==2.2.0
10-
pylint==2.6.0
11-
pytest==6.0.2
9+
pyflakes==2.4.0
10+
pylint==2.17.4
11+
pytest==7.4.0
1212
pytest-cov==2.10.1
13-
pytest-flake8==1.0.6
13+
pytest-flake8==1.1.1
1414
pytest-mypy==0.7.0
15-
pytest-pylint==0.17.0
16-
flake8-annotations==2.4.0
15+
pytest-pylint==0.19.0
16+
flake8-annotations==2.9.0
1717
flake8-polyfill==1.0.2
1818
docformatter==1.4.0
1919
mkdocs==1.2.3

run_docker.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,18 @@ elif [ "$2" = "bash" ]; then
2727
$RUN_SHELL CMD_ARGS=${CMD_ARGS[*]:2}
2828
fi
2929

30+
if [ "$ARCH" = "aarch64" ]; then
31+
DOCKER_FILE=./docker/Dockerfile.aarch64
32+
else
33+
DOCKER_FILE=./docker/Dockerfile
34+
fi
35+
3036
if [ "$1" = "build" ]; then
3137
if [ "$RUN_SHELL" = "/bin/bash" ]; then
3238
CMD_ARGS="$CMD_ARGS --build-arg USE_ZSH=false"
3339
fi
3440
echo "Building a docker image with tagname $DOCKER_TAG and arguments $CMD_ARGS"
35-
docker build . -t $DOCKER_TAG $CMD_ARGS --build-arg UID=`id -u` --build-arg GID=`id -g`
41+
docker build . -t $DOCKER_TAG -f $DOCKER_FILE $CMD_ARGS --build-arg UID=`id -u` --build-arg GID=`id -g`
3642
elif [ "$1" = "run" ]; then
3743
if test -f "$HOME/.gitconfig"; then
3844
CMD_ARGS="$CMD_ARGS -v $HOME/.gitconfig:/home/user/.gitconfig"

0 commit comments

Comments
 (0)