Created
October 4, 2022 09:50
-
-
Save r2r-dev/332fd457a5c024c2b5b3d31ecabeaaf1 to your computer and use it in GitHub Desktop.
dockerfile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# syntax=docker/dockerfile:1 | |
FROM docker.nix-community.org/nixpkgs/cachix@sha256:40fb25ae3467c9b559d35fabf4207d6c93c9ca5157513ea570cb540dae3e58d3 AS builder | |
WORKDIR /app | |
COPY jupyter_nix/nix.conf /etc/nix.conf | |
COPY jupyter_nix/ ./ | |
RUN nix-build default.nix --option sandbox false | |
RUN mkdir /tmp/nix-store-closure | |
RUN echo "Output references (Runtime dependencies):" $(nix-store -qR result/) | |
RUN cp -R $(nix-store -qR result/) /tmp/nix-store-closure | |
FROM debian/snapshot:stable-20220125 | |
COPY --from=builder /tmp/nix-store-closure /nix/store | |
COPY --from=builder /app/result /app | |
ARG bazel_version=4.2.2 | |
ARG bazel_url=https://storage.googleapis.com/bazel-apt/pool/jdk1.8/b/bazel/bazel_${bazel_version}_amd64.deb | |
RUN apt-get update && apt-get install -y \ | |
wget \ | |
&& wget "${bazel_url}" -nv -o- -O bazel.deb \ | |
&& apt-get -o Acquire::Retries=5 -o Acquire::http::Dl-Limit=800 install -y \ | |
./bazel.deb \ | |
curl \ | |
sudo \ | |
bash-completion \ | |
build-essential \ | |
default-jdk-headless \ | |
git \ | |
libfl2 \ | |
python-dev \ | |
python2.7-dev \ | |
python3-dev \ | |
vim \ | |
&& rm bazel.deb \ | |
&& apt-get clean \ | |
&& rm -rf /var/lib/apt/lists/* \ | |
&& echo ". /etc/bash_completion" >> /root/.bashrc | |
ENV NB_USER jovyan | |
ENV NB_UID 1000 | |
ENV HOME /home/${NB_USER} | |
RUN adduser --disabled-password --gecos "Default user" --uid ${NB_UID} ${NB_USER} | |
RUN usermod -aG sudo ${NB_USER} | |
COPY jupyter_config/jupyter_lab_config.py ${HOME}/.jupyter/jupyter_lab_config.py | |
COPY jupyter_config/user-settings ${HOME}/.jupyter/user-settings | |
USER root | |
RUN echo "jovyan ALL=(ALL) NOPASSWD:ALL" | tee /etc/sudoers.d/jovyan | |
RUN ln -s /app/bin/jupyter-lab /bin/ && ln -s /bin/jupyter-lab /bin/jupyter-notebook | |
RUN chown -R ${NB_UID} ${HOME} | |
USER ${NB_USER} | |
WORKDIR ${HOME} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment