Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +14 -12
Dockerfile
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
|
|
| 1 |
FROM python:3.9-slim
|
| 2 |
|
|
|
|
| 3 |
ENV LANG C.UTF-8
|
| 4 |
ENV GO_VERSION 1.23.0
|
| 5 |
ENV HUGO_VERSION latest
|
|
@@ -17,27 +19,27 @@ RUN apt-get update && apt-get install -y \
|
|
| 17 |
hugo \
|
| 18 |
&& rm -rf /var/lib/apt/lists/*
|
| 19 |
|
|
|
|
| 20 |
WORKDIR /app
|
| 21 |
|
| 22 |
-
# Copy the Hugo theme into
|
| 23 |
COPY ./app/themes/hugo-theme-stack /app/themes/hugo-theme-stack
|
| 24 |
-
|
| 25 |
-
# Copy all other project files
|
| 26 |
COPY . .
|
| 27 |
|
| 28 |
-
#
|
| 29 |
-
RUN
|
| 30 |
-
chmod -R 777 /app && \
|
| 31 |
-
mkdir -p /app/assets && chmod -R 777 /app/assets && \
|
| 32 |
-
mkdir -p /app/resources && chmod -R 777 /app/resources
|
| 33 |
|
| 34 |
-
# Remove any stale build lock
|
| 35 |
RUN rm -f /app/.hugo_build.lock
|
| 36 |
|
| 37 |
-
#
|
| 38 |
RUN hugo --ignoreCache && hugo mod clean && hugo mod get
|
| 39 |
-
RUN rm -f /app/.hugo_build.lock && hugo
|
| 40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
EXPOSE 7860
|
| 42 |
|
| 43 |
-
|
|
|
|
|
|
| 1 |
+
# Use an official Python runtime as the base image (for OS utilities)
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
| 4 |
+
# Set environment variables
|
| 5 |
ENV LANG C.UTF-8
|
| 6 |
ENV GO_VERSION 1.23.0
|
| 7 |
ENV HUGO_VERSION latest
|
|
|
|
| 19 |
hugo \
|
| 20 |
&& rm -rf /var/lib/apt/lists/*
|
| 21 |
|
| 22 |
+
# Set working directory
|
| 23 |
WORKDIR /app
|
| 24 |
|
| 25 |
+
# Copy the Hugo theme and all project files into the container
|
| 26 |
COPY ./app/themes/hugo-theme-stack /app/themes/hugo-theme-stack
|
|
|
|
|
|
|
| 27 |
COPY . .
|
| 28 |
|
| 29 |
+
# Ensure the /app directory (and its subdirectories) are writable
|
| 30 |
+
RUN chmod -R 777 /app
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
+
# Remove any stale Hugo build lock file
|
| 33 |
RUN rm -f /app/.hugo_build.lock
|
| 34 |
|
| 35 |
+
# (Optional) If you use Hugo Modules, refresh them:
|
| 36 |
RUN hugo --ignoreCache && hugo mod clean && hugo mod get
|
|
|
|
| 37 |
|
| 38 |
+
# Build the Hugo site with --noTimes to avoid file time updates
|
| 39 |
+
RUN rm -f /app/.hugo_build.lock && hugo --noTimes
|
| 40 |
+
|
| 41 |
+
# Expose the port the Hugo server will use
|
| 42 |
EXPOSE 7860
|
| 43 |
|
| 44 |
+
# Start the Hugo server with --noTimes (and other desired flags)
|
| 45 |
+
CMD ["hugo", "server", "--bind", "0.0.0.0", "--port", "7860", "--disableFastRender", "--noTimes"]
|