split dockerfile
This commit is contained in:
parent
c8e14ab2b5
commit
2910ea7e63
38
Dockerfile
38
Dockerfile
@ -1,35 +1,21 @@
|
|||||||
FROM python:3.8 as builder1
|
ARG BASE_ROOT="nexus.iqser.com:5001/red/"
|
||||||
|
ARG VERSION_TAG=latest
|
||||||
|
|
||||||
# Use a virtual environment.
|
FROM ${BASE_ROOT}detr-server-base:${VERSION_TAG}
|
||||||
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 . ./
|
|
||||||
|
|
||||||
# Set up service as a module and install all its dependencies.
|
|
||||||
RUN bash setup/docker_local.sh
|
|
||||||
|
|
||||||
# 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
|
WORKDIR /app/service
|
||||||
|
|
||||||
RUN apt update --yes
|
COPY ./src ./src
|
||||||
RUN apt install vim --yes
|
COPY ./incl/detr ./incl/detr
|
||||||
RUN apt install poppler-utils --yes
|
COPY ./fb_detr ./fb_detr
|
||||||
|
|
||||||
|
RUN python3 -m pip install -e .
|
||||||
|
|
||||||
|
WORKDIR /app/service/incl/detr
|
||||||
|
RUN python3 -m pip install -e .
|
||||||
|
WORKDIR /app/service
|
||||||
|
|
||||||
EXPOSE 5000
|
EXPOSE 5000
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|
||||||
# Run the service loop.
|
|
||||||
CMD ["python3", "src/run_service.py"]
|
CMD ["python3", "src/run_service.py"]
|
||||||
|
|||||||
29
Dockerfile-base
Normal file
29
Dockerfile-base
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
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 . ./
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
RUN apt update --yes
|
||||||
|
RUN apt install vim --yes
|
||||||
|
RUN apt install poppler-utils --yes
|
||||||
@ -11,4 +11,5 @@ dvc pull
|
|||||||
|
|
||||||
git submodule update --init --recursive
|
git submodule update --init --recursive
|
||||||
|
|
||||||
docker build -t detr-server .
|
docker build -f Dockerfile-base -t detr-server-base .
|
||||||
|
docker build -f Dockerfile -t detr-server . --build-arg VERSION_TAG=latest
|
||||||
|
|||||||
@ -1,8 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
pip install -e .
|
|
||||||
pip install -r requirements.txt
|
|
||||||
|
|
||||||
cd incl/detr
|
|
||||||
pip install -e .
|
|
||||||
Loading…
x
Reference in New Issue
Block a user