Hello there, I am fairly new to dockerfiles and want to “combine” two docker files. The reason is that I need packages from the first dockerfile in the second container but I have trouble getting it to work.
Both docker containers work fine on their own but that is of no use sadly ;(
Dockerfile 1 (main dockerfile for my backend):
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.7
WORKDIR /app/
# Install Poetry
RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | POETRY_HOME=/opt/poetry python && \
cd /usr/local/bin && \
ln -s /opt/poetry/bin/poetry && \
poetry config virtualenvs.create false
# Copy poetry.lock* in case it doesn't exist in the repo
COPY ./app/pyproject.toml ./app/poetry.lock* /app/
# Allow installing dev dependencies to run tests
ARG INSTALL_DEV=false
RUN bash -c "if [ $INSTALL_DEV == 'true' ] ; then poetry install --no-root ; else poetry install --no-root --no-dev ; fi"
# For development, Jupyter remote kernel, Hydrogen
# Using inside the container:
# jupyter lab --ip=0.0.0.0 --allow-root --NotebookApp.custom_display_url=http://127.0.0.1:8888
ARG INSTALL_JUPYTER=false
RUN bash -c "if [ $INSTALL_JUPYTER == 'true' ] ; then pip install jupyterlab ; fi"
COPY ./app /app
ENV PYTHONPATH=/app
Dockerfile 2 (contains the qiime package that I need in the backend):
FROM continuumio/miniconda3
ARG QIIME2_RELEASE
ENV PATH /opt/conda/envs/qiime2-${QIIME2_RELEASE}/bin:$PATH
ENV HOME /home/qiime2
RUN mkdir /home/qiime2
WORKDIR /home/qiime2
RUN conda update -q -y conda
RUN conda install -q -y wget
RUN apt-get install -y procps
RUN wget https://data.qiime2.org/distro/core/qiime2-${QIIME2_RELEASE}-py38-linux-conda.yml
RUN conda env create -n qiime2-${QIIME2_RELEASE} --file qiime2-${QIIME2_RELEASE}-py38-linux-conda.yml
RUN rm qiime2-${QIIME2_RELEASE}-py38-linux-conda.yml
RUN /bin/bash -c "source activate qiime2-${QIIME2_RELEASE}"
RUN qiime dev refresh-cache
RUN echo "source activate qiime2-${QIIME2_RELEASE}" >> $HOME/.bashrc
RUN echo "source tab-qiime" >> $HOME/.bashrc