Simplified dockerfile for models. Removed nonroot user and no longer creating venv in built image since it's a containerized env anyway.
This commit is contained in:
+4
-10
@@ -11,22 +11,16 @@ RUN apt update && apt upgrade -y && \
|
|||||||
apt install -y python3 python3-pip python3.11-venv && \
|
apt install -y python3 python3-pip python3.11-venv && \
|
||||||
apt clean all && rm -rf /var/lib/apt/lists/*
|
apt clean all && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Create non-root user
|
|
||||||
RUN useradd -s /bin/bash nonroot
|
|
||||||
|
|
||||||
# Create working directory
|
# Create working directory
|
||||||
RUN mkdir -p /app
|
RUN mkdir -p /app /app/public/images/
|
||||||
RUN chown -R nonroot:nonroot /app
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Switch user
|
# Installing npm packages
|
||||||
USER nonroot
|
RUN npm install
|
||||||
|
|
||||||
# Setup virtual env and install stuff
|
# Setup virtual env and install stuff
|
||||||
RUN python3 -m venv /app
|
RUN pip3 install --break-system-packages -r requirements.txt
|
||||||
RUN /app/bin/pip install --no-cache-dir -r requirements.txt
|
|
||||||
ENV PATH="/app/bin:$PATH"
|
|
||||||
|
|
||||||
# Expose model port
|
# Expose model port
|
||||||
EXPOSE 8081
|
EXPOSE 8081
|
||||||
|
|||||||
Reference in New Issue
Block a user