Skip to content
Snippets Groups Projects
Commit ed268c45 authored by Tim Kreuzer's avatar Tim Kreuzer
Browse files

init

parents
Branches
Tags
No related merge requests found
.flake8 0 → 100644
[flake8]
# Ignore style and complexity
# E: style errors
# W: style warnings
# C: complexity
# F401: module imported but unused
# F403: import *
# F811: redefinition of unused `name` from line `N`
# F841: local variable assigned but never used
# E402: module level import not at top of file
# I100: Import statements are in the wrong order
# I101: Imported names are in the wrong order. Should be
ignore = E, C, W, F401, F403, F811, F841, E402, I100, I101, D400
builtins = c, get_config
exclude =
.cache,
.github,
docs,
jupyterhub/alembic*,
onbuild,
scripts,
share,
tools,
setup.py
repos:
- repo: https://github.com/asottile/reorder_python_imports
rev: v1.9.0
hooks:
- id: reorder-python-imports
- repo: https://github.com/psf/black
rev: 20.8b1
hooks:
- id: black
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.4.0
hooks:
- id: end-of-file-fixer
- id: check-json
- id: check-yaml
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: requirements-txt-fixer
- id: flake8
# Ubuntu 20.04 (focal)
# https://hub.docker.com/_/ubuntu/?tab=tags&name=focal
# OS/ARCH: linux/amd64
ARG ROOT_CONTAINER=ubuntu:focal-20210119@sha256:3093096ee188f8ff4531949b8f6115af4747ec1c58858c091c8cb4579c39cc4e
ARG BASE_CONTAINER=$ROOT_CONTAINER
FROM $BASE_CONTAINER
LABEL maintainer="Jupyter-JSC <jupyter-jsc@fz-juelich.de>"
ARG NB_USER="jovyan"
ARG NB_UID="1094"
ARG NB_GID="100"
# Install global packages.
USER root
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update \
&& apt-get install -yq --no-install-recommends \
wget \
ca-certificates \
sudo \
locales \
fonts-liberation \
run-one \
python3.8 python3.8-dev python3.8-distutils python3.8-venv \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Copy a script that we will use to correct permissions after running certain commands
COPY fix-permissions /usr/local/bin/fix-permissions
RUN chmod a+rx /usr/local/bin/fix-permissions
# Enable prompt color in the skeleton .bashrc before creating the default NB_USER
RUN sed -i 's/^#force_color_prompt=yes/force_color_prompt=yes/' /etc/skel/.bashrc
# Create NB_USER with name jovyan user with UID=1000 and in the 'users' group
# and make sure these dirs are writable by the `users` group.
RUN echo "auth requisite pam_deny.so" >> /etc/pam.d/su && \
sed -i.bak -e 's/^%admin/#%admin/' /etc/sudoers && \
sed -i.bak -e 's/^%sudo/#%sudo/' /etc/sudoers && \
useradd -m -s /bin/bash -N -u $NB_UID $NB_USER && \
chmod g+w /etc/passwd && \
fix-permissions $HOME
# Download lua and lmod
RUN mkdir -p /opt/apps/install
RUN wget -O /opt/apps/install/lua-5.1.4.9.tar.bz2 https://sourceforge.net/projects/lmod/files/lua-5.1.4.9.tar.bz2/download
RUN wget -O /opt/apps/install/lmod-8.4.tar.bz2 https://sourceforge.net/projects/lmod/files/Lmod-8.4.tar.bz2/download
RUN apt-get update \
&& apt-get install -yq --no-install-recommends \
build-essential \
make \
rsync \
tcl-dev \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Install lua
COPY --chown=root:root ./install_files/lua /opt/apps/install/lua
RUN /bin/bash /opt/apps/install/lua/install_lua_5.1.4.9.sh
# Install lmod
COPY --chown=root:root ./install_files/lmod /opt/apps/install/lmod
RUN /bin/bash /opt/apps/install/lmod/install_lmod_8.4.sh
RUN apt-get update \
&& apt-get install -yq --no-install-recommends \
curl \
curlftpfs \
davfs2 \
fuse \
git \
less \
vim \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - && apt install -y gcc g++ nodejs
RUN wget -O /tmp/libssl1.0.0.deb http://security.ubuntu.com/ubuntu/pool/main/o/openssl1.0/libssl1.0.0_1.0.2n-1ubuntu5.6_amd64.deb && apt install /tmp/libssl1.0.0.deb
WORKDIR /home/$NB_USER
COPY --chown=$NB_UID:$NB_GID bashrc /etc/bash.bashrc
RUN chown -R root:root /root && chmod o-w /tmp && chmod 644 /etc/bash.bashrc
RUN mkdir -p /mnt/JUDAC && chown ${NB_UID}:${NB_GID} /mnt/JUDAC
RUN mkdir -p /mnt/B2DROP && usermod -aG davfs2 jovyan && echo "https://b2drop.eudat.eu/remote.php/webdav /mnt/B2DROP davfs user,rw,noauto 0 0" >> /etc/fstab && chmod u+s /usr/sbin/mount.davfs && chown ${NB_UID}:${NB_GID} /mnt/B2DROP
USER jovyan
bashrc 0 → 100644
# System-wide .bashrc file for interactive bash(1) shells.
# To enable the settings / commands in this file for login shells as well,
# this file has to be sourced in /etc/profile.
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# set a fancy prompt (non-color, overwrite the one in /etc/profile)
# but only if not SUDOing and have SUDO_PS1 set; then assume smart user.
if ! [ -n "${SUDO_USER}" -a -n "${SUDO_PS1}" ]; then
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
# Commented out, don't overwrite xterm -T "title" -n "icontitle" by default.
# If this is an xterm set the title to user@host:dir
#case "$TERM" in
#xterm*|rxvt*)
# PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
# ;;
#*)
# ;;
#esac
# enable bash completion in interactive shells
#if ! shopt -oq posix; then
# if [ -f /usr/share/bash-completion/bash_completion ]; then
# . /usr/share/bash-completion/bash_completion
# elif [ -f /etc/bash_completion ]; then
# . /etc/bash_completion
# fi
#fi
# sudo hint
if [ ! -e "$HOME/.sudo_as_admin_successful" ] && [ ! -e "$HOME/.hushlogin" ] ; then
case " $(groups) " in *\ admin\ *|*\ sudo\ *)
if [ -x /usr/bin/sudo ]; then
cat <<-EOF
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
EOF
fi
esac
fi
# if the command-not-found package is installed, use it
if [ -x /usr/lib/command-not-found -o -x /usr/share/command-not-found/command-not-found ]; then
function command_not_found_handle {
# check because c-n-f could've been removed in the meantime
if [ -x /usr/lib/command-not-found ]; then
/usr/lib/command-not-found -- "$1"
return $?
elif [ -x /usr/share/command-not-found/command-not-found ]; then
/usr/share/command-not-found/command-not-found -- "$1"
return $?
else
printf "%s: command not found\n" "$1" >&2
return 127
fi
}
fi
# module package should be loaded even if it's not a login shell
if [ -f "/etc/profile.d/z00_lmod.sh" ]; then
. "/etc/profile.d/z00_lmod.sh"
fi
#!/bin/bash
# set permissions on a directory
# after any installation, if a directory needs to be (human) user-writable,
# run this script on it.
# It will make everything in the directory owned by the group $NB_GID
# and writable by that group.
# Deployments that want to set a specific user id can preserve permissions
# by adding the `--group-add users` line to `docker run`.
# uses find to avoid touching files that already have the right permissions,
# which would cause massive image explosion
# right permissions are:
# group=$NB_GID
# AND permissions include group rwX (directory-execute)
# AND directories have setuid,setgid bits set
set -e
for d in "$@"; do
find "$d" \
! \( \
-group $NB_GID \
-a -perm -g+rwX \
\) \
-exec chgrp $NB_GID {} \; \
-exec chmod g+rwX {} \;
# setuid, setgid *on directories only*
find "$d" \
\( \
-type d \
-a ! -perm -6000 \
\) \
-exec chmod +6000 {} \;
done
#!/bin/bash
cd /opt/apps/install
tar xf lmod-8.4.tar.bz2
cd /opt/apps/install/Lmod-8.4
./configure --prefix /opt/apps
make install
ln -s /opt/apps/lmod/lmod/init/profile /etc/profile.d/z00_lmod.sh
ln -s /opt/apps/lmod/lmod/init/cshrc /etc/profile.d/z00_lmod.csh
#!/bin/bash
cd /opt/apps/install
tar xf lua-5.1.4.9.tar.bz2
cd /opt/apps/install/lua-5.1.4.9
./configure --prefix /opt/apps/lua/5.1.4.9
make
make install
ln -s /opt/apps/lua/5.1.4.9 /opt/apps/lua/lua
ln -s /opt/apps/lua/lua/bin/lua /usr/local/bin
ln -s /opt/apps/lua/lua/bin/luac /usr/local/bin
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment