|
1 | | -# Use an official Ubuntu as a parent image |
2 | | -FROM ubuntu:22.04 |
| 1 | +FROM mcr.microsoft.com/devcontainers/miniconda:3 |
3 | 2 |
|
4 | 3 | # Set environment variables for Conda |
5 | 4 | ENV PATH=/opt/conda/bin:$PATH |
6 | | -ENV MYSQL_ROOT_PASSWORD=dj_secret123 |
7 | 5 | ENV DJ_HOST=localhost |
8 | | -ENV DJ_PASS=$MYSQL_ROOT_PASSWORD |
9 | | -ENV DJ_USER=root |
| 6 | +ENV DJ_PASS=$DJ_PASS |
| 7 | +ENV DJ_USER=$DJ_USER |
10 | 8 |
|
11 | | -# Install necessary system tools |
| 9 | +# Install system dependencies including netcat for connection checking |
12 | 10 | RUN apt-get update && apt-get install -y \ |
13 | 11 | wget \ |
14 | 12 | vim \ |
15 | | - bzip2 \ |
16 | | - ca-certificates \ |
17 | 13 | curl \ |
18 | 14 | git \ |
19 | | - webp \ |
20 | | - mysql-server \ |
| 15 | + netcat-openbsd \ |
| 16 | + default-mysql-client \ |
21 | 17 | && rm -rf /var/lib/apt/lists/* |
22 | 18 |
|
23 | | -# Download and install Miniconda |
24 | | -RUN ARCH=$(uname -m) && \ |
25 | | - if [ "$ARCH" = "x86_64" ]; then \ |
26 | | - MINICONDA_URL="https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh"; \ |
27 | | - elif [ "$ARCH" = "aarch64" ]; then \ |
28 | | - MINICONDA_URL="https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-aarch64.sh"; \ |
29 | | - else \ |
30 | | - echo "Unsupported architecture: $ARCH" && exit 1; \ |
31 | | - fi && \ |
32 | | - wget --quiet $MINICONDA_URL -O /tmp/miniconda.sh && \ |
33 | | - /bin/bash /tmp/miniconda.sh -b -p /opt/conda && \ |
34 | | - rm /tmp/miniconda.sh && \ |
35 | | - conda config --set auto_update_conda false && \ |
36 | | - conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main && \ |
37 | | - conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r && \ |
38 | | - conda clean --all -f -y && \ |
39 | | - conda install -n base libarchive -c main --force-reinstall --solver classic |
40 | | - |
41 | 19 | # Install additional tools or packages as needed in the base environment |
42 | 20 | RUN conda init bash && \ |
43 | | - conda install -n base -c conda-forge python=3.11 python-graphviz jupyterlab 'nodejs>20,<21' pip -y && \ |
44 | | - pip install ipython-sql && \ |
| 21 | + conda install -n base -c conda-forge python-graphviz jupyter jupysql 'nodejs>20,<21' && \ |
45 | 22 | pip install mystmd && \ |
46 | 23 | pip install jupyterlab_myst && \ |
47 | | - pip install git+https://github.com/datajoint/datajoint-python.git && \ |
48 | | - pip install Faker |
49 | | - |
50 | | -# Set up shell to use Conda by default |
51 | | -RUN echo "source /opt/conda/etc/profile.d/conda.sh && conda activate base" >> ~/.bashrc |
| 24 | + pip install git+https://github.com/datajoint/datajoint-python.git |
52 | 25 |
|
53 | | -# Configure MySQL to allow remote connections (optional) |
54 | | -RUN sed -i 's/bind-address\s*=.*/bind-address = 0.0.0.0/' /etc/mysql/mysql.conf.d/mysqld.cnf |
55 | | - |
56 | | -# Initialize MySQL with the root password |
57 | | -RUN service mysql start && \ |
58 | | - mysqladmin -u root password "$MYSQL_ROOT_PASSWORD" && \ |
59 | | - mysql -u root -p"$MYSQL_ROOT_PASSWORD" -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH 'mysql_native_password' BY '$MYSQL_ROOT_PASSWORD'; FLUSH PRIVILEGES;" |
60 | 26 |
|
61 | 27 | # Expose ports for JupyterLab and MySQL |
62 | | -EXPOSE 3306 |
63 | | - |
64 | | -# Default command for the Devcontainer |
65 | | -CMD ["bash"] |
| 28 | +EXPOSE 8888 |
0 commit comments