dailydev.com / Dockerfile
AstraOS's picture
Update Dockerfile
7f2a26e verified
raw
history blame
1.63 kB
# Use an official Python runtime as the base image (we're using it just for OS utilities)
FROM gohugoio/hugo:0.111.3-ext-alpine
# 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 is writable (make sure no host volume is mounted over /app at runtime)
RUN mkdir -p /app && chmod -R 777 /app
# Copy your Hugo theme into /app/themes and the rest of your project files
COPY ./app/themes/hugo-theme-stack /app/themes/hugo-theme-stack
COPY . .
# Remove any stale build lock file (if present)
RUN rm -f /app/.hugo_build.lock
# Run Hugo module commands and build the site
RUN hugo --ignoreCache && hugo mod clean && hugo mod get && rm -f /app/.hugo_build.lock && hugo
# Expose the port Hugo will use
EXPOSE 7860
# At container start, remove any stale build lock file and launch Hugo server
CMD ["sh", "-c", "rm -f /app/.hugo_build.lock && hugo server --bind 0.0.0.0 --port 7860 --disableFastRender"]