swahili-tts-model / Dockerfile
mosha255's picture
Updates docker healthcheck
d359f48 unverified
# Use the official Python image from the Docker Hub
FROM python:3.10-slim
# Set the working directory in the container
WORKDIR /app
# Install git and git-lfs
RUN apt-get update \
&& apt-get install -y git git-lfs libsndfile1 nginx \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& git lfs install
# Setup nginx folders and permissions
RUN mkdir -p /var/cache/nginx \
/var/log/nginx \
/var/lib/nginx
RUN touch /var/run/nginx.pid
RUN useradd -m -u 1000 user
RUN chown -R user:user /var/cache/nginx \
/var/log/nginx \
/var/lib/nginx \
/var/run/nginx.pid
# Copy Nginx configuration
COPY --chown=user nginx.conf /etc/nginx/sites-enabled/app.conf
# Remove default config and Test nginx
RUN rm /etc/nginx/sites-enabled/default && nginx -t && service nginx start
# Copy the requirements file into the container
COPY --chown=user requirements.txt .
# Install the required packages
RUN pip install --no-cache-dir -r requirements.txt \
# Install gruut[sw] separately
&& pip install -f 'https://synesthesiam.github.io/prebuilt-apps/' 'gruut[sw]'
# Copy the rest of the application code into the container
COPY --chown=user . .
# Expose the port the app runs on (from nginx)
EXPOSE 7860
HEALTHCHECK --interval=10s --timeout=5s --start-period=5s --retries=3 \
CMD ["sh", "/app/healthcheck.sh"]
# Use exec form to call the script
CMD ["/app/startup.sh"]