dailydev.com / Dockerfile
AstraOS's picture
Update Dockerfile
6eeaae9 verified
raw
history blame
1.45 kB
# Use an official Python runtime as the base image for Hugging Face and other dependencies
FROM python:3.9-slim
# Set environment variables for Hugging Face, Hugo and the working directory
ENV LANG C.UTF-8
ENV HUGO_VERSION 0.112.5
# Install system dependencies, including Hugo and others needed for Hugging Face
RUN apt-get update && apt-get install -y \
curl \
git \
unzip \
ca-certificates \
libcurl4-openssl-dev \
libssl-dev \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Install Hugo
RUN curl -sSL https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_Linux-64bit.deb -o hugo.deb \
&& dpkg -i hugo.deb \
&& rm hugo.deb
# Install Python dependencies for Hugging Face
RUN pip install --no-cache-dir \
transformers \
torch \
huggingface_hub \
fastapi \
uvicorn
# Create a working directory for the Hugo site and the Hugging Face models
WORKDIR /app
# Copy the Hugo site files into the container
COPY ./content/post /app/content/post
# Build the Hugo site (you can change this if needed based on your Hugo site structure)
RUN cd /app/content/post && hugo
# Expose the port the server will run on (adjust as needed for your setup)
EXPOSE 7860
# Define the command to run both the Hugging Face API server and the Hugo site
CMD ["sh", "-c", "cd /app/content/post && hugo server --bind 0.0.0.0 & uvicorn app:app --host 0.0.0.0 --port 7860"]