Spaces:
Sleeping
Sleeping
| # Use an official Python runtime as the base image (for OS utilities) | |
| 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/* | |
| # Set working directory | |
| WORKDIR /app | |
| # Create /app (if not already) and make sure it's writable | |
| RUN mkdir -p /app && chmod -R 777 /app | |
| # Copy the Hugo theme into /app/themes | |
| COPY ./app/themes/hugo-theme-stack /app/themes/hugo-theme-stack | |
| # Copy the rest of your project files into the container | |
| COPY . . | |
| # **Reset permissions for all files inside /app** | |
| RUN chmod -R 777 /app | |
| # Remove any stale build lock file (if present) | |
| RUN rm -f /app/.hugo_build.lock | |
| # (Optional) If using Hugo Modules, run these commands to clean cache and get modules. | |
| RUN hugo | |
| # Build the Hugo site (this will generate the public directory) | |
| RUN rm -f /app/.hugo_build.lock && hugo | |
| # Expose the desired port (7860 in your case) | |
| EXPOSE 7860 | |
| # At container start, remove any stale build lock file and launch the Hugo server | |
| CMD ["sh", "-c", "hugo server --bind 0.0.0.0 --port 7860 --disableFastRender"] | |