haystack/docker/Dockerfile.api
Fabian e53cc2bc3f
fix(docker): Use IMAGE_NAME in api image (#3786)
If you set the IMAGE_NAME variable, then the base image will use that name,
but the api image would previously use a hardcoded `deepset/haystack` image name.
2023-01-03 12:26:26 +01:00

26 lines
871 B
Docker

ARG base_image_tag
ARG base_image
FROM ${base_image}:${base_image_tag}
ENV SERVICE_NAME="gunicorn-service"
RUN addgroup --gid 1001 $SERVICE_NAME && \
adduser --gid 1001 --uid 1001 --shell /bin/false --disabled-password $SERVICE_NAME && \
mkdir -p /var/log/$SERVICE_NAME && \
chown $SERVICE_NAME:$SERVICE_NAME /var/log/$SERVICE_NAME
# Create a folder for the /file-upload API endpoint with write permissions for the service user only
RUN mkdir -p /opt/file-upload && chown $SERVICE_NAME:$SERVICE_NAME /opt/file-upload && chmod 600 /opt/file-upload
# Tell rest_api which folder to use for uploads
ENV FILE_UPLOAD_PATH="/opt/file-upload"
ENV TIKA_LOG_PATH="/var/log/$SERVICE_NAME/"
EXPOSE 8000
USER $SERVICE_NAME
CMD ["gunicorn", "rest_api.application:app", "-b", "0.0.0.0", "-k", "uvicorn.workers.UvicornWorker", "--workers", "1", "--timeout", "180"]