Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,16 @@ LABEL vendor="MBARI"
LABEL maintainer="dcline@mbari.org"
LABEL license="Apache License 2.0"

ARG UID=1001
ARG GID=1001

# curl needed for health-check; clean apt in same layer to avoid bloating
RUN apt-get update && apt-get install -y --no-install-recommends curl && \
apt-get clean && rm -rf /var/lib/apt/lists/*

RUN groupadd --gid ${GID} appuser && \
useradd --uid ${UID} --gid ${GID} --no-create-home appuser

ENV PATH="/venv/bin:$PATH"
ENV APP_HOME=/app
ENV HF_HOME=/tmp/transformers_cache
Expand All @@ -36,6 +42,10 @@ WORKDIR $APP_HOME
COPY --from=builder /venv /venv
COPY . .

RUN chown -R appuser:appuser /app /venv

USER ${UID}:${GID}

EXPOSE 80
WORKDIR $APP_HOME/src/app
CMD ["sh", "-c", "exec uvicorn main:app --host 0.0.0.0 --port 80 --ws-max-size 10485760"]
10 changes: 10 additions & 0 deletions Dockerfile.cuda
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ LABEL vendor="MBARI"
LABEL maintainer="dcline@mbari.org"
LABEL license="Apache License 2.0"

ARG UID=1001
ARG GID=1001

RUN apt-get update && \
apt-get install -y --no-install-recommends software-properties-common && \
add-apt-repository ppa:deadsnakes/ppa && \
Expand All @@ -42,6 +45,9 @@ RUN apt-get update && \
curl libxcb1 libxcb-xinerama0 libxrender1 libxext6 libsm6 libice6 libgl1 && \
apt-get clean && rm -rf /var/lib/apt/lists/*

RUN groupadd --gid ${GID} appuser && \
useradd --uid ${UID} --gid ${GID} --no-create-home appuser

ENV PATH="/venv/bin:$PATH"
ENV APP_HOME=/app
ENV HF_HOME=/tmp/transformers_cache
Expand All @@ -55,6 +61,10 @@ WORKDIR $APP_HOME
COPY --from=builder /venv /venv
COPY . .

RUN chown -R appuser:appuser /app /venv

USER ${UID}:${GID}

ARG NUM_WORKERS=1
ENV NUM_WORKERS=${NUM_WORKERS}
EXPOSE 80
Expand Down
Loading