update Dockerfiles
This commit is contained in:
parent
c32005b841
commit
7b37f3c913
43
Dockerfile
43
Dockerfile
@ -1,23 +1,36 @@
|
||||
FROM image-prediction-base
|
||||
FROM python:3.8
|
||||
|
||||
WORKDIR /app/service
|
||||
ARG USERNAME
|
||||
ARG TOKEN
|
||||
ARG PYPI_REGISTRY_RESEARCH=https://gitlab.knecon.com/api/v4/groups/19/-/packages/pypi
|
||||
ARG POETRY_SOURCE_REF_RESEARCH=gitlab-research
|
||||
ARG PYPI_REGISTRY_RED=https://gitlab.knecon.com/api/v4/groups/12/-/packages/pypi
|
||||
ARG POETRY_SOURCE_REF_RED=gitlab-red
|
||||
ARG VERSION=dev
|
||||
|
||||
COPY src src
|
||||
COPY incl/pyinfra incl/pyinfra
|
||||
COPY data data
|
||||
COPY image_prediction image_prediction
|
||||
COPY setup.py setup.py
|
||||
COPY requirements.txt requirements.txt
|
||||
COPY config.yaml config.yaml
|
||||
COPY banner.txt banner.txt
|
||||
LABEL maintainer="Research <research@knecon.com>"
|
||||
LABEL version="${VERSION}"
|
||||
|
||||
# Install dependencies differing from base image.
|
||||
RUN python3 -m pip install -r requirements.txt
|
||||
WORKDIR /app
|
||||
|
||||
RUN python3 -m pip install -e .
|
||||
RUN python3 -m pip install incl/pyinfra
|
||||
ENV PYTHONUNBUFFERED=true
|
||||
ENV POETRY_HOME=/opt/poetry
|
||||
ENV PATH="$POETRY_HOME/bin:$PATH"
|
||||
|
||||
RUN curl -sSL https://install.python-poetry.org | python3 -
|
||||
|
||||
COPY ./data ./data
|
||||
COPY pyproject.toml poetry.lock banner.txt config.yaml ./src ./image_prediction ./
|
||||
|
||||
RUN poetry config virtualenvs.create false && \
|
||||
poetry config installer.max-workers 10 && \
|
||||
poetry config repositories.${POETRY_SOURCE_REF_RESEARCH} ${PYPI_REGISTRY_RESEARCH} && \
|
||||
poetry config http-basic.${POETRY_SOURCE_REF_RESEARCH} ${USERNAME} ${TOKEN} && \
|
||||
poetry config repositories.${POETRY_SOURCE_REF_RED} ${PYPI_REGISTRY_RED} && \
|
||||
poetry config http-basic.${POETRY_SOURCE_REF_RED} ${USERNAME} ${TOKEN} && \
|
||||
poetry install --without=test -vv --no-interaction --no-root
|
||||
|
||||
EXPOSE 5000
|
||||
EXPOSE 8080
|
||||
|
||||
CMD ["python3", "src/serve.py"]
|
||||
CMD [ "python", "serve.py"]
|
||||
|
||||
@ -1,25 +0,0 @@
|
||||
FROM python:3.8 as builder1
|
||||
|
||||
# Use a virtual environment.
|
||||
RUN python -m venv /app/venv
|
||||
ENV PATH="/app/venv/bin:$PATH"
|
||||
|
||||
# Upgrade pip.
|
||||
RUN python -m pip install --upgrade pip
|
||||
|
||||
# Make a directory for the service files and copy the service repo into the container.
|
||||
WORKDIR /app/service
|
||||
COPY ./requirements.txt ./requirements.txt
|
||||
|
||||
# Install dependencies.
|
||||
RUN python3 -m pip install -r requirements.txt
|
||||
|
||||
# Make a new container and copy all relevant files over to filter out temporary files
|
||||
# produced during setup to reduce the final container's size.
|
||||
FROM python:3.8
|
||||
|
||||
WORKDIR /app/
|
||||
COPY --from=builder1 /app .
|
||||
ENV PATH="/app/venv/bin:$PATH"
|
||||
|
||||
WORKDIR /app/service
|
||||
@ -1,24 +1,37 @@
|
||||
ARG BASE_ROOT="nexus.iqser.com:5001/red/"
|
||||
ARG VERSION_TAG="dev"
|
||||
FROM python:3.8
|
||||
|
||||
FROM ${BASE_ROOT}image-prediction:${VERSION_TAG}
|
||||
ARG USERNAME
|
||||
ARG TOKEN
|
||||
ARG PYPI_REGISTRY_RESEARCH=https://gitlab.knecon.com/api/v4/groups/19/-/packages/pypi
|
||||
ARG POETRY_SOURCE_REF_RESEARCH=gitlab-research
|
||||
ARG PYPI_REGISTRY_RED=https://gitlab.knecon.com/api/v4/groups/12/-/packages/pypi
|
||||
ARG POETRY_SOURCE_REF_RED=gitlab-red
|
||||
ARG VERSION=dev
|
||||
|
||||
WORKDIR /app/service
|
||||
LABEL maintainer="Research <research@knecon.com>"
|
||||
LABEL version="${VERSION}"
|
||||
|
||||
COPY src src
|
||||
COPY incl/pyinfra incl/pyinfra
|
||||
COPY data data
|
||||
COPY image_prediction image_prediction
|
||||
COPY setup.py setup.py
|
||||
COPY requirements.txt requirements.txt
|
||||
COPY config.yaml config.yaml
|
||||
COPY banner.txt banner.txt
|
||||
WORKDIR /app
|
||||
|
||||
# Install module & dependencies
|
||||
RUN python3 -m pip install -r requirements.txt
|
||||
ENV PYTHONUNBUFFERED=true
|
||||
ENV POETRY_HOME=/opt/poetry
|
||||
ENV PATH="$POETRY_HOME/bin:$PATH"
|
||||
|
||||
RUN python3 -m pip install -e .
|
||||
RUN python3 -m pip install incl/pyinfra
|
||||
RUN curl -sSL https://install.python-poetry.org | python3 -
|
||||
|
||||
COPY ./data ./data
|
||||
COPY pyproject.toml poetry.lock banner.txt config.yaml ./src ./image_prediction ./
|
||||
|
||||
RUN poetry config virtualenvs.create false && \
|
||||
poetry config installer.max-workers 10 && \
|
||||
poetry config repositories.${POETRY_SOURCE_REF_RESEARCH} ${PYPI_REGISTRY_RESEARCH} && \
|
||||
poetry config http-basic.${POETRY_SOURCE_REF_RESEARCH} ${USERNAME} ${TOKEN} && \
|
||||
poetry config repositories.${POETRY_SOURCE_REF_RED} ${PYPI_REGISTRY_RED} && \
|
||||
poetry config http-basic.${POETRY_SOURCE_REF_RED} ${USERNAME} ${TOKEN} && \
|
||||
poetry install --without=test -vv --no-interaction --no-root
|
||||
|
||||
EXPOSE 5000
|
||||
EXPOSE 8080
|
||||
|
||||
RUN apt update --yes
|
||||
RUN apt install vim --yes
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user