dailydev.com / Dockerfile
AstraOS's picture
Update Dockerfile
3f424aa verified
raw
history blame
1.66 kB
# Use an official Python runtime as the base image for Hugging Face and other dependencies
FROM python:3.9-slim
# Set environment variables
ENV LANG C.UTF-8
ENV GO_VERSION 1.23.0
ENV HUGO_VERSION latest
# Install system dependencies, including Go, GCC, and others needed for Hugo
RUN apt-get update && apt-get install -y \
curl \
git \
build-essential \
gcc \
unzip \
ca-certificates \
libcurl4-openssl-dev \
libssl-dev \
hugo \
&& rm -rf /var/lib/apt/lists/*
# Install Go
RUN curl -sSL https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz -o go${GO_VERSION}.tar.gz \
&& tar -xvzf go${GO_VERSION}.tar.gz \
&& mv go /usr/local/ \
&& rm go${GO_VERSION}.tar.gz
# Set Go binary path
ENV PATH="/usr/local/go/bin:${PATH}"
# Install Hugo from source (Standard edition)
RUN go install github.com/gohugoio/hugo@${HUGO_VERSION}
# 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 ./content /app/content
COPY ./config /app/config
COPY ./static /app/static
COPY ./assets /app/assets
# Ensure Hugo Modules are fetched (this is important for theme dependencies)
# RUN hugo mod get
# Copy the theme into the /themes directory
COPY ./hugo-theme-stack /app/themes
# Build the Hugo site
RUN hugo
# Expose the port the server will run on
EXPOSE 7860
# Define the command to run both the Hugo site and the Hugging Face API
CMD ["sh", "-c", "hugo server --bind 0.0.0.0 & uvicorn app:app --host 0.0.0.0 --port 7860"]