@@ -19,14 +19,16 @@ RUN set -eux; \
1919 useradd --no-log-init -g $DOCKER_USER --uid=$DOCKER_HOST_UID \
2020 -d $DOCKER_USER_HOME -ms /bin/bash $DOCKER_USER
2121RUN mkdir /application && chown $DOCKER_USER:$DOCKER_USER /application
22- RUN curl -s \
23- "https://archlinux.org/mirrorlist/?country=$MIRROR_LIST_COUNTRY&protocol=http&protocol=https&ip_version=4" \
24- | sed -e 's/^#Server/Server/' -e '/^#/d' > /etc/pacman.d/mirrorlist
25- RUN pacman -Syu --noconfirm && pacman -S --noconfirm $BUILD_PACKAGES
22+ RUN set -eux; \
23+ curl -fsSL "https://archlinux.org/mirrorlist/?country=${MIRROR_LIST_COUNTRY}&protocol=http&protocol=https&ip_version=4" \
24+ | sed -e 's/^\s *#Server/Server/' -e '/^\s *#/d' \
25+ > /etc/pacman.d/mirrorlist; \
26+ grep -q '^Server' /etc/pacman.d/mirrorlist
27+ RUN pacman -Syu --noconfirm && pacman -S --noconfirm --needed $BUILD_PACKAGES
2628RUN echo "${DOCKER_USER} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
2729ENV PYENV_ROOT=$DOCKER_USER_HOME/.pyenv
2830ENV PATH=$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH
29- RUN pyenv install $PYTHON_VERSION
31+ RUN pyenv install --skip-existing $PYTHON_VERSION
3032RUN pyenv global $PYTHON_VERSION
3133RUN pyenv rehash
3234ENV PYTHONUNBUFFERED=1
@@ -39,7 +41,7 @@ ENV VIRTUAL_ENV=/opt/venv
3941RUN python -m venv --copies $VIRTUAL_ENV
4042ENV PATH=$VIRTUAL_ENV/bin:$PATH
4143RUN pip install --upgrade pip
42- RUN curl -sSL https://install.python-poetry.org | python -
44+ RUN curl -sSL https://install.python-poetry.org | POETRY_VERSION=$POETRY_VERSION python -
4345ENV PATH=$POETRY_HOME/bin:$PATH
4446ENV PYTHONPATH=/application/src
4547ENV PROJECT_ROOT=/application
@@ -62,14 +64,17 @@ ARG POETRY_OPTIONS_APP="--only main --compile"
6264RUN poetry install $POETRY_OPTIONS_APP -n -v -C /build && \
6365 rm -rf $POETRY_CACHE_DIR/* && rm -rf $PIP_CACHE_DIR/*
6466RUN sed -i "/\b\( $DOCKER_USER\)\b /d" /etc/sudoers
65- RUN pacman -Scc <<< Y <<< Y
67+ RUN pacman -Scc --noconfirm
6668USER $DOCKER_USER
6769WORKDIR /application
6870
6971FROM python-base AS build-deps-dev
72+ ARG DOCKER_USER=devuser
7073ARG POETRY_OPTIONS_DEV="--no-root --with-dev --compile"
7174COPY pyproject.toml poetry.lock /build/
7275RUN poetry install $POETRY_OPTIONS_DEV -n -v -C /build
76+ RUN mkdir -p $POETRY_CACHE_DIR $PIP_CACHE_DIR && \
77+ chown -R $DOCKER_USER $POETRY_CACHE_DIR $PIP_CACHE_DIR
7378
7479FROM build-deps-dev AS dev-build
7580ARG DOCKER_USER=devuser
@@ -80,7 +85,9 @@ FROM build-deps-dev AS vim-ide
8085ARG DOCKER_USER=devuser
8186ARG DOCKER_USER_HOME=/home/devuser
8287ARG VIM_PACKAGES="python vim ctags ripgrep bat npm nodejs-lts-jod"
83- RUN pacman -Sy && pacman -S --noconfirm $VIM_PACKAGES
88+ ARG NPM_GLOBAL_PACKAGES=""
89+ RUN pacman -S --noconfirm --needed $VIM_PACKAGES
90+ RUN if [ -n "$NPM_GLOBAL_PACKAGES" ]; then npm install -g --no-fund --no-audit $NPM_GLOBAL_PACKAGES; fi
8491USER $DOCKER_USER
8592RUN curl -fLo $DOCKER_USER_HOME/.vim/autoload/plug.vim --create-dirs \
8693 https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
0 commit comments