Skip to content

Commit

Permalink
deploy(docker): initial smoc-api client dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdoret committed Feb 8, 2024
1 parent 1ec0e23 commit 3dc2a92
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
FROM python:3.11-slim

ENV PYTHONUNBUFFERED=true
WORKDIR /app

LABEL org.opencontainers.image.source=https://github.com/sdsc-ordes/smoc-api
LABEL org.opencontainers.image.description="Serve multi-omics digital objejcts"
LABEL org.opencontainers.image.licenses=Apache-2.0

##################################################
# Poetry setup
##################################################
FROM python as poetry

# Install poetry
ENV POETRY_HOME=/opt/poetry
ENV POETRY_VIRTUALENVS_IN_PROJECT=true
ENV PATH="$POETRY_HOME/bin:$PATH"
RUN python -c 'from urllib.request import urlopen; print(urlopen("https://install.python-poetry.org").read().decode())' | python -

# Copy necessary files only
COPY ./modo/ ./modo
COPY ./pyproject.toml ./pyproject.toml
COPY ./poetry.lock ./poetry.lock
RUN apt-get update && \
apt-get install -y gcc

# Poetry install
RUN poetry install --no-interaction --no-ansi -vvv


##################################################
# SMOC server setup
##################################################
FROM python as runtime
ENV PATH="/app/.venv/bin:$PATH"
COPY --from=poetry /app /app

# Set user
RUN useradd -ms /bin/bash modo_user
USER modo_user

# Test run
RUN modo --version

CMD ["modo"]

0 comments on commit 3dc2a92

Please sign in to comment.