Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +17 -31
Dockerfile
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
# Use an official Python runtime as the base image for
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
| 4 |
# Set environment variables
|
|
@@ -6,7 +6,7 @@ ENV LANG C.UTF-8
|
|
| 6 |
ENV GO_VERSION 1.23.0
|
| 7 |
ENV HUGO_VERSION latest
|
| 8 |
|
| 9 |
-
# Install system dependencies, including
|
| 10 |
RUN apt-get update && apt-get install -y \
|
| 11 |
curl \
|
| 12 |
git \
|
|
@@ -19,6 +19,9 @@ RUN apt-get update && apt-get install -y \
|
|
| 19 |
hugo \
|
| 20 |
&& rm -rf /var/lib/apt/lists/*
|
| 21 |
|
|
|
|
|
|
|
|
|
|
| 22 |
# Install Go
|
| 23 |
# RUN curl -sSL https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz -o go${GO_VERSION}.tar.gz \
|
| 24 |
# && tar -xvzf go${GO_VERSION}.tar.gz \
|
|
@@ -28,43 +31,26 @@ RUN apt-get update && apt-get install -y \
|
|
| 28 |
# Set Go binary path
|
| 29 |
# ENV PATH="/usr/local/go/bin:${PATH}"
|
| 30 |
|
| 31 |
-
#
|
| 32 |
-
# RUN go install github.com/gohugoio/hugo@${HUGO_VERSION}
|
| 33 |
-
|
| 34 |
-
# Install Python dependencies for Hugging Face
|
| 35 |
-
RUN pip install --no-cache-dir \
|
| 36 |
-
# transformers \
|
| 37 |
-
# torch \
|
| 38 |
-
huggingface_hub \
|
| 39 |
-
fastapi \
|
| 40 |
-
uvicorn
|
| 41 |
-
|
| 42 |
-
# # Create a working directory for the Hugo site and the Hugging Face models
|
| 43 |
WORKDIR /app
|
| 44 |
|
| 45 |
-
#
|
| 46 |
-
# COPY ./config /app/config
|
| 47 |
-
# COPY ./static /app/static
|
| 48 |
-
# COPY ./assets /app/assets
|
| 49 |
-
|
| 50 |
-
# # Ensure Hugo Modules are fetched (this is important for theme dependencies)
|
| 51 |
-
# # RUN hugo mod get
|
| 52 |
-
|
| 53 |
-
# # Copy the theme into the /themes directory
|
| 54 |
COPY ./app/themes/hugo-theme-stack /app/themes/hugo-theme-stack
|
| 55 |
|
|
|
|
| 56 |
COPY . .
|
| 57 |
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
&& hugo mod get
|
| 61 |
|
| 62 |
-
#
|
| 63 |
-
RUN hugo
|
| 64 |
|
|
|
|
|
|
|
| 65 |
|
| 66 |
-
# Expose the port the server
|
| 67 |
EXPOSE 7860
|
| 68 |
|
| 69 |
-
#
|
| 70 |
-
CMD ["
|
|
|
|
| 1 |
+
# Use an official Python runtime as the base image (for minimal OS, even though we’re not using Python)
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
| 4 |
# Set environment variables
|
|
|
|
| 6 |
ENV GO_VERSION 1.23.0
|
| 7 |
ENV HUGO_VERSION latest
|
| 8 |
|
| 9 |
+
# Install system dependencies, including Hugo and its requirements
|
| 10 |
RUN apt-get update && apt-get install -y \
|
| 11 |
curl \
|
| 12 |
git \
|
|
|
|
| 19 |
hugo \
|
| 20 |
&& rm -rf /var/lib/apt/lists/*
|
| 21 |
|
| 22 |
+
# (Optional) Remove Python dependencies if you don't need them for Hugging Face
|
| 23 |
+
RUN pip install --no-cache-dir huggingface_hub fastapi uvicorn
|
| 24 |
+
|
| 25 |
# Install Go
|
| 26 |
# RUN curl -sSL https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz -o go${GO_VERSION}.tar.gz \
|
| 27 |
# && tar -xvzf go${GO_VERSION}.tar.gz \
|
|
|
|
| 31 |
# Set Go binary path
|
| 32 |
# ENV PATH="/usr/local/go/bin:${PATH}"
|
| 33 |
|
| 34 |
+
# Create and set the working directory for the Hugo site
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
WORKDIR /app
|
| 36 |
|
| 37 |
+
# Copy the Hugo theme into the /app/themes directory
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
COPY ./app/themes/hugo-theme-stack /app/themes/hugo-theme-stack
|
| 39 |
|
| 40 |
+
# Copy the rest of your project files into the container
|
| 41 |
COPY . .
|
| 42 |
|
| 43 |
+
# Fix permissions so that Hugo can create its build lock file without errors
|
| 44 |
+
RUN chmod -R 777 /app
|
|
|
|
| 45 |
|
| 46 |
+
# Run Hugo module commands to fetch any modules (if your site uses Hugo Modules)
|
| 47 |
+
RUN hugo --ignoreCache && hugo mod clean && hugo mod get
|
| 48 |
|
| 49 |
+
# Build the Hugo site (this will generate the public directory)
|
| 50 |
+
RUN hugo
|
| 51 |
|
| 52 |
+
# Expose the port for the Hugo server (default is 1313, but here we're using 7860 as specified)
|
| 53 |
EXPOSE 7860
|
| 54 |
|
| 55 |
+
# Start the Hugo development server, binding to all network interfaces
|
| 56 |
+
CMD ["hugo", "server", "--bind", "0.0.0.0", "--port", "7860", "--disableFastRender"]
|