Skip to content
Snippets Groups Projects
Dockerfile 1.74 KiB
# This is nrao:notification
FROM python:3.10-slim-buster as base
ARG DEPLOY_ENV
ARG WS_VERSION=unknown-version
ENV DEPLOY_ENV=${DEPLOY_ENV}

# Environment variables
ENV PIP_NO_CACHE_DIR false
ENV CAPO_PROFILE docker
ENV CAPO_PATH /home/ssa/capo

# Get postgres/mysql development stuff in the image
RUN apt update \
    && apt install -y --no-install-recommends \
    gcc \
    libmariadb-dev-compat \
    libpq-dev \
    && rm -rf /var/lib/apt/lists

# Create vlapipe group and create vlapipe user placed in vlapipe group
RUN addgroup --gid 6000 vlapipe && \
    useradd --create-home --comment "" --gid 6000 --uid 6000 vlapipe

# Create almapipe group and create almapipe user placed in almapipe group
RUN addgroup --gid 9233 almapipe && \
    useradd --create-home --comment "" --gid 9233 --uid 9233 almapipe

USER root
WORKDIR /code/
RUN chown vlapipe . && chgrp vlapipe .
RUN apt update -y && apt install -y curl -y nano

# package installation
USER vlapipe
RUN curl -sSL https://install.python-poetry.org | python3 -

ENV PATH "${PATH}:/home/vlapipe/.local/bin"
COPY --chown=vlapipe:vlapipe ./shared ./shared
COPY --chown=vlapipe:vlapipe ./apps/cli ./apps/cli
#COPY --chown=vlapipe:vlapipe ./services/notification/requirements.txt ./requirements.txt
#RUN SETUPTOOLS_SCM_PRETEND_VERSION=${WS_VERSION} pip install --user -r requirements.txt

# Copy service directory to /code in the image
# set ownership of content to vlapipe and the vlapipe group
COPY --chown=vlapipe:vlapipe ./services/notification ./services/notification
WORKDIR /code/services/notification
RUN poetry install


FROM base as prod
ENV PYTHONPATH "${PYTHONPATH}:/home/vlapipe/.local"
CMD poetry run pserve --reload ${DEPLOY_ENV}.ini

FROM base as dev

CMD ["poetry", "run", "pserve", "--reload", "dev.ini"]