1# Use a minimal base image.
2FROM alpine:latest
3
4# Install supplementary tools.
5RUN ["apk", "add", "curl"]
6
7# Download and run the setup script.
8RUN curl -fsSL https://raw.githubusercontent.com/mutagen-io/mutagen/master/scripts/container/provision.sh | sh
9
10# Add tunnel credentials.
11COPY ["tunnel.tunn", "/tunnel.tunn"]
12
13# Add the jovyan user with a uid of 1000 to match permissions with the Jupyter
14# container. The users group already exists in Alpine with the same gid of 100.
15RUN ["adduser", "-h", "/home/jovyan", "-u", "1000", "-G", "users", "-D", "jovyan"]
16
17# Create a placeholder for the shared volume and set its ownership. The mounted
18# volume will inherit the permissions of the placeholder directory. This needs
19# to be done in each container where the volume will be mounted, because the
20# volume will inherit the first permissions it sees (which, if absent, default
21# to root). See https://github.com/moby/moby/issues/2259 for more information.
22RUN ["mkdir", "/home/jovyan/data-science"]
23RUN ["chown", "jovyan:users", "/home/jovyan/data-science"]
24
25# Tell the container to run as the jovyan user.
26USER jovyan:users
27
28# Set tunnel hosting to be the container entrypoint.
29ENTRYPOINT ["mutagen", "tunnel", "host", "/tunnel.tunn"]
30