dailydev.com / Dockerfile
AstraOS's picture
Update Dockerfile
b9b22dd verified
raw
history blame
1.75 kB
# Use an official Python runtime as the base image (for minimal OS, even though we're only using Hugo)
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 Hugo and its requirements
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/*
RUN pip install --no-cache-dir huggingface_hub fastapi uvicorn
# 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}"
# Set working directory
WORKDIR /app
# Ensure /app exists, is owned by root, and is writable by all users.
RUN mkdir -p /app && chown -R root:root /app && chmod -R 777 /app
# Copy the Hugo theme into the /app/themes directory
COPY ./app/themes/hugo-theme-stack /app/themes/hugo-theme-stack
# Copy all project files into the container
COPY . .
# Remove any pre-existing build lock file before proceeding.
RUN rm -f /app/.hugo_build.lock
# (Optional) If you're using Hugo Modules, run these commands to clean cache and get modules.
RUN hugo --ignoreCache && hugo mod clean && hugo mod get
# Remove the build lock file again, then build the Hugo site.
RUN rm -f /app/.hugo_build.lock && hugo
# Expose the desired port (7860 in your case)
EXPOSE 7860
# Start the Hugo server, binding to all interfaces.
CMD ["hugo", "server", "--bind", "0.0.0.0", "--port", "7860", "--disableFastRender"]