Skip to content

Commit c69c4a7

Browse files
committed
Initial commit
0 parents  commit c69c4a7

File tree

4 files changed

+105
-0
lines changed

4 files changed

+105
-0
lines changed

.gitignore

Whitespace-only changes.

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Coder Images
2+
3+
Container images for use with [Coder](https://github.com/coder/coder)
4+
5+
## Jupyter Docker Stacks Images
6+
7+
We repackage several of the [Jupyter Docker Stacks](https://github.com/jupyter/docker-stacks) images with necessary changes to work with Coder.
8+
9+
### Manual Build Instructions
10+
11+
Some images may need to be built locally due to container image size limitations in GitHub Actions.
12+
As of writing, this limitation is currently 10GB.
13+
14+
In order to build the Jupyter Docker Stack-based images locally, we need to specify the build target of `notebook-image`, i.e.:
15+
16+
```
17+
docker build . -f Dockerfile -t [your-dockerhub-username]/[image-name]:v[x.x] --target notebook-image
18+
```
19+
20+
#### Local Testing
21+
22+
In order to test these images locally, we need to include the second build stage `local-testing` which installs and runs coder in the container image.
23+
This includes a custom script for use as the container's entrypoint `run-coder.sh`.
24+
The manual configuration in the `local-testing` target is typically handled by Coder via template, so as to install the latest version at runtime as opposed to manually installing a version at build time.
25+
26+
*Note*: The `local-testing` targets should **NOT** be used with Coder due to the increased container image size and potentially conflicting installations of coder.
27+
28+
Due to the location of `run-coder.sh`, Jupyter images should be built from the root of the repository, for example:
29+
30+
```
31+
docker build . -f /image/jupyter/minimal/Dockerfile -t [your-dockerhub-username]/coder-minimal-notebook:v[x.x] --target local-testing
32+
```

images/jupyter/minimal/Dockerfile

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
ARG BASE_IMAGE=quay.io/jupyter/minimal-notebook:2025-07-07
2+
3+
FROM ${BASE_IMAGE} AS notebook-image
4+
5+
USER root
6+
ENV DEBIAN_FRONTEND=noninteractive
7+
RUN apt-get update && \
8+
apt-get install -y --no-install-recommends \
9+
bash \
10+
ca-certificates \
11+
curl \
12+
git \
13+
jq \
14+
locales \
15+
sudo \
16+
rclone \
17+
&& rm -rf /var/lib/apt/lists/*
18+
19+
# Generate the desired locale (en_US.UTF-8)
20+
RUN locale-gen en_US.UTF-8
21+
22+
# Make typing unicode characters in the terminal work.
23+
ENV LANG=en_US.UTF-8
24+
ENV LANGUAGE=en_US.UTF-8
25+
ENV LC_ALL=en_US.UTF-8
26+
27+
# Remove the `jovyan` user and add a user `coder` so that you're not developing as the `root` user
28+
RUN userdel -r ${NB_USER} \
29+
&& useradd coder \
30+
--create-home \
31+
--shell=/bin/bash \
32+
--uid=1000 \
33+
--user-group \
34+
&& echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd \
35+
&& chown -R coder:coder /home/coder
36+
37+
# Switch to coder user, override env vars from Jupyter base image
38+
USER coder
39+
WORKDIR /home/coder
40+
ENV HOME=/home/coder
41+
ENV NB_USER=coder
42+
43+
FROM notebook-image AS local-testing
44+
45+
USER root
46+
WORKDIR /root
47+
48+
# Fix permissions for coder home directory
49+
RUN chown -R coder:coder /home/coder
50+
51+
# Add directory for coder install for local testing in Docker; transer owner to coder user & group
52+
RUN mkdir -p /opt/code-server \
53+
&& chown -R coder:coder /opt/code-server
54+
55+
USER coder
56+
WORKDIR /home/coder
57+
58+
# Install coder/code-server for local testing in Docker -- coder will install its own version at runtime
59+
RUN curl -fsSL https://code-server.dev/install.sh | sh -s -- --method=standalone --prefix=/opt/code-server
60+
61+
# Override entrypoint and healthcheck from Jupyter base image for local testing in Docker
62+
COPY run-coder.sh /opt/run-coder.sh
63+
ENTRYPOINT [ "sh", "/opt/run-coder.sh" ]
64+
HEALTHCHECK --interval=30s --timeout=5s --start-period=60s --retries=5 \
65+
CMD curl -fsS http://0.0.0.0:13337/healthz || exit 1
66+
67+
# Expose coder port for local testing in Docker
68+
EXPOSE 13337
69+

run-coder.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/env bash
2+
3+
/opt/code-server/bin/code-server --auth none --port 13337 --bind-addr 0.0.0.0 > /tmp/code-server.log 2>&1
4+

0 commit comments

Comments
 (0)