Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +12 -17
Dockerfile
CHANGED
|
@@ -1,12 +1,12 @@
|
|
| 1 |
-
# Use an official Python runtime as the base image (
|
| 2 |
-
FROM
|
| 3 |
|
| 4 |
# Set environment variables
|
| 5 |
ENV LANG C.UTF-8
|
| 6 |
ENV GO_VERSION 1.23.0
|
| 7 |
ENV HUGO_VERSION latest
|
| 8 |
|
| 9 |
-
# Install system dependencies
|
| 10 |
RUN apt-get update && apt-get install -y \
|
| 11 |
curl \
|
| 12 |
git \
|
|
@@ -33,26 +33,21 @@ RUN pip install --no-cache-dir huggingface_hub fastapi uvicorn
|
|
| 33 |
# Set working directory
|
| 34 |
WORKDIR /app
|
| 35 |
|
| 36 |
-
# Ensure /app
|
| 37 |
-
RUN mkdir -p /app &&
|
| 38 |
|
| 39 |
-
# Copy
|
| 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
|
| 46 |
RUN rm -f /app/.hugo_build.lock
|
| 47 |
|
| 48 |
-
#
|
| 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
|
| 55 |
EXPOSE 7860
|
| 56 |
|
| 57 |
-
#
|
| 58 |
-
CMD ["
|
|
|
|
| 1 |
+
# Use an official Python runtime as the base image (we're using it just for OS utilities)
|
| 2 |
+
FROM gohugoio/hugo:0.111.3-ext-alpine
|
| 3 |
|
| 4 |
# Set environment variables
|
| 5 |
ENV LANG C.UTF-8
|
| 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 \
|
|
|
|
| 33 |
# Set working directory
|
| 34 |
WORKDIR /app
|
| 35 |
|
| 36 |
+
# Ensure /app is writable (make sure no host volume is mounted over /app at runtime)
|
| 37 |
+
RUN mkdir -p /app && chmod -R 777 /app
|
| 38 |
|
| 39 |
+
# Copy your Hugo theme into /app/themes and the rest of your project files
|
| 40 |
COPY ./app/themes/hugo-theme-stack /app/themes/hugo-theme-stack
|
|
|
|
|
|
|
| 41 |
COPY . .
|
| 42 |
|
| 43 |
+
# Remove any stale build lock file (if present)
|
| 44 |
RUN rm -f /app/.hugo_build.lock
|
| 45 |
|
| 46 |
+
# Run Hugo module commands and build the site
|
| 47 |
+
RUN hugo --ignoreCache && hugo mod clean && hugo mod get && rm -f /app/.hugo_build.lock && hugo
|
|
|
|
|
|
|
|
|
|
| 48 |
|
| 49 |
+
# Expose the port Hugo will use
|
| 50 |
EXPOSE 7860
|
| 51 |
|
| 52 |
+
# At container start, remove any stale build lock file and launch Hugo server
|
| 53 |
+
CMD ["sh", "-c", "rm -f /app/.hugo_build.lock && hugo server --bind 0.0.0.0 --port 7860 --disableFastRender"]
|