kopia lustrzana https://github.com/jupyterhub/repo2docker
normalize ENV syntax, combine more layers
rodzic
803a1c223b
commit
df733fc81b
|
@ -27,18 +27,18 @@ RUN apt-get -qq update && \
|
||||||
RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \
|
RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \
|
||||||
locale-gen
|
locale-gen
|
||||||
|
|
||||||
ENV LC_ALL en_US.UTF-8
|
ENV LC_ALL=en_US.UTF-8 \
|
||||||
ENV LANG en_US.UTF-8
|
LANG=en_US.UTF-8 \
|
||||||
ENV LANGUAGE en_US.UTF-8
|
LANGUAGE=en_US.UTF-8
|
||||||
|
|
||||||
# Use bash as default shell, rather than sh
|
# Use bash as default shell, rather than sh
|
||||||
ENV SHELL /bin/bash
|
ENV SHELL=/bin/bash
|
||||||
|
|
||||||
# Set up user
|
# Set up user
|
||||||
ARG NB_USER
|
ARG NB_USER
|
||||||
ARG NB_UID
|
ARG NB_UID
|
||||||
ENV USER ${NB_USER}
|
ENV USER=${NB_USER} \
|
||||||
ENV HOME /home/${NB_USER}
|
HOME=/home/${NB_USER}
|
||||||
|
|
||||||
RUN groupadd \
|
RUN groupadd \
|
||||||
--gid ${NB_UID} \
|
--gid ${NB_UID} \
|
||||||
|
@ -81,13 +81,13 @@ EXPOSE 8888
|
||||||
{% if build_env -%}
|
{% if build_env -%}
|
||||||
# Environment variables required for build
|
# Environment variables required for build
|
||||||
{% for item in build_env -%}
|
{% for item in build_env -%}
|
||||||
ENV {{item[0]}} {{item[1]}}
|
ENV {{item[0]}}={{item[1]}}
|
||||||
{% endfor -%}
|
{% endfor -%}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
|
|
||||||
{% if path -%}
|
{% if path -%}
|
||||||
# Special case PATH
|
# Special case PATH
|
||||||
ENV PATH {{ ':'.join(path) }}:${PATH}
|
ENV PATH={{ ':'.join(path) }}:${PATH}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
|
|
||||||
{% if build_script_files -%}
|
{% if build_script_files -%}
|
||||||
|
@ -105,9 +105,15 @@ USER root
|
||||||
|
|
||||||
# Allow target path repo is cloned to be configurable
|
# Allow target path repo is cloned to be configurable
|
||||||
ARG REPO_DIR=${HOME}
|
ARG REPO_DIR=${HOME}
|
||||||
RUN [ ! -d ${REPO_DIR} ] \
|
ENV REPO_DIR=${REPO_DIR}
|
||||||
&& mkdir -p ${REPO_DIR} \
|
RUN if [ ! -d "${REPO_DIR}" ] \
|
||||||
&& chown -R ${NB_USER}:${NB_USER} ${REPO_DIR}
|
; then \
|
||||||
|
mkdir -p "${REPO_DIR}" \
|
||||||
|
&& chown -R ${NB_USER}:${NB_USER} "${REPO_DIR}" \
|
||||||
|
; else \
|
||||||
|
echo "${REPO_DIR} already exists..." \
|
||||||
|
; fi
|
||||||
|
|
||||||
WORKDIR ${REPO_DIR}
|
WORKDIR ${REPO_DIR}
|
||||||
RUN chown ${NB_USER}:${NB_USER} ${REPO_DIR}
|
RUN chown ${NB_USER}:${NB_USER} ${REPO_DIR}
|
||||||
|
|
||||||
|
@ -119,12 +125,12 @@ RUN chown ${NB_USER}:${NB_USER} ${REPO_DIR}
|
||||||
#
|
#
|
||||||
# The XDG standard suggests ~/.local/bin as the path for local user-specific
|
# The XDG standard suggests ~/.local/bin as the path for local user-specific
|
||||||
# installs. See https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
# installs. See https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
||||||
ENV PATH ${HOME}/.local/bin:${REPO_DIR}/.local/bin:${PATH}
|
ENV PATH=${HOME}/.local/bin:${REPO_DIR}/.local/bin:${PATH}
|
||||||
|
|
||||||
{% if env -%}
|
{% if env -%}
|
||||||
# The rest of the environment
|
# The rest of the environment
|
||||||
{% for item in env -%}
|
{% for item in env -%}
|
||||||
ENV {{item[0]}} {{item[1]}}
|
ENV {{item[0]}}={{item[1]}}
|
||||||
{% endfor -%}
|
{% endfor -%}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
|
|
||||||
|
@ -175,7 +181,7 @@ RUN ./{{ s }}
|
||||||
# Add start script
|
# Add start script
|
||||||
{% if start_script is not none -%}
|
{% if start_script is not none -%}
|
||||||
RUN chmod +x "{{ start_script }}"
|
RUN chmod +x "{{ start_script }}"
|
||||||
ENV R2D_ENTRYPOINT "{{ start_script }}"
|
ENV R2D_ENTRYPOINT="{{ start_script }}"
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
|
|
||||||
# Add entrypoint
|
# Add entrypoint
|
||||||
|
|
Ładowanie…
Reference in New Issue