Skip to content

Commit

Permalink
Move Dockerfile from Conda to pip
Browse files Browse the repository at this point in the history
  • Loading branch information
the-other-james committed Nov 13, 2024
1 parent 0457d32 commit 493cdb4
Showing 1 changed file with 19 additions and 25 deletions.
44 changes: 19 additions & 25 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:20.04
FROM ubuntu:22.04

ARG USER_ID
ARG GROUP_ID
Expand All @@ -15,8 +15,6 @@ RUN useradd -l -u ${USER_ID} -g ${GROUP_ID} onair_dev
RUN mkdir /home/onair_dev && \
chown onair_dev /home/onair_dev

# TODO: add ssh with X forwarding

# Install
RUN \
apt-get update && \
Expand All @@ -39,38 +37,34 @@ RUN \

# OnAIR Dependencies
RUN \
apt-get install -y wget
apt-get install -y python3.11 && \
apt-get install -y python3.11-dev && \
apt-get install -y python3-pip

# Add new packages to install here to prevent re-running previous instructions

# Ensure that all packages are up to date after new packages have been added above
RUN \
apt-get update && \
apt-get -y upgrade && \
rm -rf /var/lib/apt/lists/*

# Add user to sudoers so that they can up the mqueue depth
# Add user to sudoers so that they can up the mqueue depth (for cFS)
RUN adduser onair_dev sudo
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers

USER onair_dev
# Make OnAir requirements files accessible by onair_dev user
COPY requirements-dev.txt /home/onair_dev/requirements-dev.txt
COPY requirements-run.txt /home/onair_dev/requirements-run.txt
COPY requirements-unittest.txt /home/onair_dev/requirements-unittest.txt
COPY requirements-lint.txt /home/onair_dev/requirements-lint.txt
RUN chown onair_dev /home/onair_dev/requirements*

# Install miniconda
ENV CONDA_DIR /home/onair_dev/conda
RUN \
mkdir -p $CONDA_DIR && \
wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh -O ~/miniforge.sh && \
bash ~/miniforge.sh -b -u -p $CONDA_DIR && \
rm -rf ~/miniforge.sh
ENV PATH=$CONDA_DIR/bin:$PATH
USER onair_dev

# Make OnAir requirements file accessible by onair_dev user
COPY environment_dev.yml /home/onair_dev/environment.yml
RUN \
. $CONDA_DIR/etc/profile.d/conda.sh && \
conda init bash && \
. ~/.bashrc && \
conda env create -f /home/onair_dev/environment.yml && \
conda activate onair
# Python stuff is being installed for the local user
ENV PATH="${PATH}:/home/onair_dev/.local/bin"

# Make sure that the onair conda environment is loaded
RUN \
echo "conda activate onair" >> ~/.bashrc
# Install OnAIR deps
RUN python3.11 -m pip install --upgrade pip setuptools wheel
RUN python3.11 -m pip install --user -r /home/onair_dev/requirements-dev.txt

0 comments on commit 493cdb4

Please sign in to comment.