Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate off Anaconda to Poetry and create dedicated RMG-Py builder image #165

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .env.dev
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# environment configuration for vscode
RMGpy=../RMG-Py
PYTHONPATH=${RMGpy}:${PYTHONPATH}
POSTGRES_DB=postgres
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
Expand Down
33 changes: 24 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
FROM ghcr.io/comocheng/kineticmodelssite/kms-build:latest
# Fetch RMG-Py build
FROM comocheng/kms-rmgpy:latest as rmgpy
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comocheng/kms-rmgpy doesn't exist yet - this should be where the Dockerfile.rmg image should be built to


COPY environment.yml /app/
RUN conda config --set channel_priority strict
RUN conda env update --prefix $ENV_PREFIX --file environment.yml
RUN conda clean -afy
ENV PATH /kms_env/bin:$PATH
ENV CONDA_DEFAULT_ENV /kms_env
RUN source activate /kms_env
# Application
FROM python:3.9-alpine

COPY . /app/
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
POETRY_HOME="/opt/poetry" \
POETRY_NO_INTERACTION=1

COPY --from=rmgpy /rmg/RMG-Py/rmgpy /rmgpy

RUN apk add --no-cache curl \
&& (curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -)
ENV PATH="$POETRY_HOME/bin:$PATH" \
PYTHONPATH="/rmgpy:$PYTHONPATH"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that RMG-Py is not specified as a dependency in the pyproject.toml - the dependency is added to the PYTHONPATH here


WORKDIR /app

COPY pyproject.toml poetry.lock ./
RUN poetry install --no-dev --no-interaction

COPY . .

CMD [ "./bin/entrypoint.sh" ]
19 changes: 0 additions & 19 deletions Dockerfile.build

This file was deleted.

21 changes: 21 additions & 0 deletions Dockerfile.rmg
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Builds RMG-Py from source to /rmg/RMG-Py/rmgpy
FROM continuumio/miniconda3:latest

RUN apt update && apt -y install \
g++ \
gcc \
git \
make

WORKDIR /rmg
RUN git clone https://github.com/ReactionMechanismGenerator/RMG-Py.git \
&& git clone https://github.com/ReactionMechanismGenerator/RMG-database.git

WORKDIR /rmg/RMG-Py
ENV PYTHONUNBUFFERED=1

RUN conda env create -v --file environment.yml
SHELL ["conda", "run", "-n", "rmg_env", "/bin/bash", "-c"]
RUN make

WORKDIR /rmg/RMG-Py/rmgpy
12 changes: 4 additions & 8 deletions docker-compose.debug.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
version: "3.8"
version: "3.7"

services:
db:
image: postgres
env_file: .env.dev
ports:
- "5432:5432"
env_file:
- ./.env.dev
debug:
build: .
tty: true
env_file:
- ./.env.dev
env_file: .env.dev
volumes:
- .:/app
- rmg-models:/app/rmg-models
- conda:/kms_env
ports:
- "5678:5678"
- "8080:8080"
depends_on:
- db

volumes:
rmg-models:
external: true
conda:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This volume should no longer be necessary

external: true
15 changes: 4 additions & 11 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,18 @@
version: "3.8"
version: "3.7"

services:
db:
image: postgres
expose:
- 5432
env_file:
- ./.env
env_file: .env
web:
build: .
command: ./bin/entrypoint.sh
env_file: .env
volumes:
- .:/app
- static:/app/static
- media:/app/media
- rmg-models:/app/rmg-models
expose:
- 8000
depends_on:
- db
env_file:
- ./.env
nginx:
build: ./nginx
volumes:
Expand All @@ -30,6 +22,7 @@ services:
- "8000:80"
depends_on:
- web

volumes:
static:
media:
Expand Down
33 changes: 0 additions & 33 deletions environment.yml

This file was deleted.

Loading