Skip to content

Commit dbe16b0

Browse files
feat(dev): Add dev.Dockerfile
1 parent eaf1f0a commit dbe16b0

File tree

3 files changed

+110
-1
lines changed

3 files changed

+110
-1
lines changed

dev.Dockerfile

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
FROM ghcr.io/astral-sh/uv:debian AS tidy3d-python-client-dev
2+
3+
ENV DEBIAN_FRONTEND=noninteractive
4+
5+
RUN apt-get update && \
6+
apt-get install -y --no-install-recommends \
7+
curl \
8+
git \
9+
xsel \
10+
xclip
11+
12+
ENV POETRY_HOME=/opt/poetry
13+
RUN curl -sSL https://install.python-poetry.org | python3 -
14+
ENV PATH="/root/.local/bin:${POETRY_HOME}/bin:${PATH}"
15+
16+
RUN apt-get update && DEBIAN_FRONTEND="noninteractive" TZ="America/New_York" apt-get install -y curl \
17+
&& curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux-x86_64.tar.gz \
18+
&& tar -C /opt -xzf nvim-linux-x86_64.tar.gz \
19+
&& rm nvim-linux-x86_64.tar.gz
20+
ENV PATH="/opt/nvim-linux-x86_64/bin:$PATH"
21+
22+
RUN addgroup --gid 1000 flexdaemon && \
23+
adduser --uid 1000 --gid 1000 \
24+
--home /home/flexdaemon \
25+
--shell /bin/bash \
26+
--disabled-password \
27+
flexdaemon \
28+
&& if getent group video >/dev/null 2>&1; then usermod -aG video flexdaemon; fi \
29+
&& if getent group render >/dev/null 2>&1; then usermod -aG render flexdaemon; fi \
30+
&& mkdir -p /home/flexdaemon \
31+
&& chown -R flexdaemon:flexdaemon /home/flexdaemon \
32+
&& chmod a+rX /home \
33+
&& chmod a+rwX /home/flexdaemon
34+
35+
USER flexdaemon
36+
WORKDIR /home/flexdaemon
37+
CMD ["sleep", "infinity"]

docs/development/docker.rst

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
Docker Development Image Installation
2+
=====================================
3+
4+
5+
Quick Start Guide
6+
-----------------
7+
8+
This guide is for anyone setting up the development environment for the first time or migrating from a version after ``2.9.0`` that the dev.Dockerfile image was enabled.
9+
10+
Prerequisites
11+
^^^^^^^^^^^^^^^
12+
13+
1. Install **Docker Engine**. You can find the official instructions here: `https://docs.docker.com/engine/install/ <https://docs.docker.com/engine/install/>`_.
14+
- *Note for Ubuntu users*: It's recommended to avoid installing Docker from the Snap store.
15+
2. Follow the official `Linux post-installation steps <https://docs.docker.com/engine/install/linux-postinstall/>`_ to run Docker commands without ``sudo`` and to enable the Docker daemon to start on boot.
16+
3. **Reboot** your system for all group changes to take effect.
17+
18+
Setup and Usage
19+
^^^^^^^^^^^^^^^^^
20+
21+
Follow these steps in your terminal to clone the repository, build the Docker image, and launch a development session.
22+
23+
.. code-block:: bash
24+
25+
# 1. Clone the repository and navigate into it
26+
git clone https://github.com/flexcompute/tidy3d.git
27+
cd tidy3d
28+
29+
# 2. Build the development Docker image
30+
docker build -t tidy3d-python-client-dev -f dev.Dockerfile .
31+
32+
# 3. Create a persistent container with your local code mounted
33+
# This also maps port 8888 for tools like Jupyter Lab
34+
docker container create --name=tidy3d_python_client_dev \
35+
--userns=host \
36+
-p 8888:8888 \
37+
-v .:/home/flexdaemon/tidy3d \
38+
tidy3d-python-client-dev
39+
40+
# 4. Start the container
41+
docker start tidy3d_python_client_dev
42+
43+
# 5. Open an interactive shell inside the running container
44+
docker exec -it tidy3d_python_client_dev /bin/bash
45+
46+
You are now inside the container's shell. From here, you can set up the Python environment.
47+
48+
.. code-block:: bash
49+
50+
# (Inside Container) 6. Create a virtual environment and activate it
51+
uv venv -p 3.11
52+
source .venv/bin/activate
53+
54+
# (Inside Container) 7. Install the project in editable mode with dev dependencies
55+
uv pip install -e .[dev]
56+
57+
With the environment ready, you can run tests, format code, or start a Jupyter Lab session.
58+
59+
Running Jupyter Lab
60+
^^^^^^^^^^^^^^^^^^^
61+
62+
To run a Jupyter Lab instance that's accessible from your host machine's web browser, execute the following command from within the container's shell:
63+
64+
.. code-block:: bash
65+
66+
# (Inside Container) Make sure your virtual environment is activated!
67+
jupyter lab . --ip=0.0.0.0
68+
69+
After it starts, Jupyter will print a URL to the terminal containing a security token. It will look like this:
70+
``http://127.0.0.1:8888/lab?token=...``
71+
72+
Copy this complete URL and paste it into your web browser (like Firefox) on your host machine to begin your session.

docs/notebooks

Submodule notebooks updated 89 files

0 commit comments

Comments
 (0)