Commit 6b93b8f1 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Updated WebUI Dockerfile

parent 5b24fcc1
Loading
Loading
Loading
Loading
+21 −9
Original line number Diff line number Diff line
@@ -12,14 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM python:3-slim
FROM python:3.9-slim

# Ref: https://pythonspeed.com/articles/activate-virtualenv-dockerfile/

# Install dependencies
RUN apt-get --yes --quiet --quiet update && \
    apt-get --yes --quiet --quiet install wget g++ && \
    rm -rf /var/lib/apt/lists/*
# RUN apt-get --yes --quiet --quiet update && \
#     apt-get --yes --quiet --quiet install wget g++ && \
#     rm -rf /var/lib/apt/lists/*

# Set Python to show logs as they occur
ENV PYTHONUNBUFFERED=0
@@ -30,7 +30,7 @@ ENV PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION='python'
#     wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-amd64 && \
#     chmod +x /bin/grpc_health_probe

# creating a user for security reasons
# Creating a user for security reasons
RUN groupadd -r webui && useradd --no-log-init -r -m -g webui webui
USER webui

@@ -42,9 +42,21 @@ WORKDIR /home/webui/teraflow
ENV VIRTUAL_ENV=/home/webui/venv
RUN python3 -m venv ${VIRTUAL_ENV}
ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"
COPY --chown=webui:webui webui/requirements.in /home/webui/teraflow/webui/requirements.in
RUN pip install --upgrade pip setuptools wheel pip-tools && pip-compile --output-file=webui/requirements.txt webui/requirements.in
RUN pip install -r webui/requirements.txt

# Get generic Python packages
RUN python3 -m pip install --upgrade pip
RUN python3 -m pip install --upgrade setuptools wheel
RUN python3 -m pip install --upgrade pip-tools

# Get common Python packages
# Note: this step enables sharing the previous Docker build steps among all the Python components
COPY --chown=webui:webui common_requirements.in common_requirements.in
RUN pip-compile --quiet --output-file=common_requirements.txt common_requirements.in
RUN python3 -m pip install -r common_requirements.txt

COPY --chown=webui:webui src/webui/requirements.in requirements.in
RUN pip-compile --output-file=requirements.txt requirements.in
RUN pip install -r requirements.txt

# Add files into working directory
COPY --chown=webui:webui common/. common
@@ -59,5 +71,5 @@ COPY --chown=webui:webui service/proto/. service/proto
COPY --chown=webui:webui service/client/. service/client
COPY --chown=webui:webui webui/. webui

# Start webui service
# Start the service
ENTRYPOINT ["python", "-m", "webui.service"]