Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +13 -11
Dockerfile
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
# Use an official Python runtime as the base image (for minimal OS, even though we
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
| 4 |
# Set environment variables
|
|
@@ -19,7 +19,6 @@ RUN apt-get update && apt-get install -y \
|
|
| 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
|
|
@@ -31,26 +30,29 @@ RUN pip install --no-cache-dir huggingface_hub fastapi uvicorn
|
|
| 31 |
# Set Go binary path
|
| 32 |
# ENV PATH="/usr/local/go/bin:${PATH}"
|
| 33 |
|
| 34 |
-
#
|
| 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
|
| 41 |
COPY . .
|
| 42 |
|
| 43 |
-
#
|
| 44 |
-
RUN
|
| 45 |
|
| 46 |
-
#
|
| 47 |
RUN hugo --ignoreCache && hugo mod clean && hugo mod get
|
| 48 |
|
| 49 |
-
#
|
| 50 |
-
RUN hugo
|
| 51 |
|
| 52 |
-
# Expose the port
|
| 53 |
EXPOSE 7860
|
| 54 |
|
| 55 |
-
# Start the Hugo
|
| 56 |
CMD ["hugo", "server", "--bind", "0.0.0.0", "--port", "7860", "--disableFastRender"]
|
|
|
|
| 1 |
+
# Use an official Python runtime as the base image (for minimal OS, even though we're only using Hugo)
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
| 4 |
# Set environment variables
|
|
|
|
| 19 |
hugo \
|
| 20 |
&& rm -rf /var/lib/apt/lists/*
|
| 21 |
|
|
|
|
| 22 |
RUN pip install --no-cache-dir huggingface_hub fastapi uvicorn
|
| 23 |
|
| 24 |
# Install Go
|
|
|
|
| 30 |
# Set Go binary path
|
| 31 |
# ENV PATH="/usr/local/go/bin:${PATH}"
|
| 32 |
|
| 33 |
+
# Set working directory
|
| 34 |
WORKDIR /app
|
| 35 |
|
| 36 |
+
# Ensure /app exists, is owned by root, and is writable by all users.
|
| 37 |
+
RUN mkdir -p /app && chown -R root:root /app && chmod -R 777 /app
|
| 38 |
+
|
| 39 |
# Copy the Hugo theme into the /app/themes directory
|
| 40 |
COPY ./app/themes/hugo-theme-stack /app/themes/hugo-theme-stack
|
| 41 |
|
| 42 |
+
# Copy all project files into the container
|
| 43 |
COPY . .
|
| 44 |
|
| 45 |
+
# Remove any pre-existing build lock file before proceeding.
|
| 46 |
+
RUN rm -f /app/.hugo_build.lock
|
| 47 |
|
| 48 |
+
# (Optional) If you're using Hugo Modules, run these commands to clean cache and get modules.
|
| 49 |
RUN hugo --ignoreCache && hugo mod clean && hugo mod get
|
| 50 |
|
| 51 |
+
# Remove the build lock file again, then build the Hugo site.
|
| 52 |
+
RUN rm -f /app/.hugo_build.lock && hugo
|
| 53 |
|
| 54 |
+
# Expose the desired port (7860 in your case)
|
| 55 |
EXPOSE 7860
|
| 56 |
|
| 57 |
+
# Start the Hugo server, binding to all interfaces.
|
| 58 |
CMD ["hugo", "server", "--bind", "0.0.0.0", "--port", "7860", "--disableFastRender"]
|