Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +10 -17
Dockerfile
CHANGED
|
@@ -1,7 +1,5 @@
|
|
| 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,32 +17,27 @@ RUN apt-get update && apt-get install -y \
|
|
| 19 |
hugo \
|
| 20 |
&& rm -rf /var/lib/apt/lists/*
|
| 21 |
|
| 22 |
-
# Set working directory
|
| 23 |
WORKDIR /app
|
| 24 |
|
| 25 |
-
# Create /app (if not already) and make sure it's writable
|
| 26 |
-
RUN mkdir -p /app && chmod -R 777 /app
|
| 27 |
-
|
| 28 |
# Copy the Hugo theme into /app/themes
|
| 29 |
COPY ./app/themes/hugo-theme-stack /app/themes/hugo-theme-stack
|
| 30 |
|
| 31 |
-
# Copy
|
| 32 |
COPY . .
|
| 33 |
|
| 34 |
-
#
|
| 35 |
-
RUN
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
-
# Remove any stale build lock
|
| 38 |
RUN rm -f /app/.hugo_build.lock
|
| 39 |
|
| 40 |
-
#
|
| 41 |
-
RUN hugo
|
| 42 |
-
|
| 43 |
-
# Build the Hugo site (this will generate the public directory)
|
| 44 |
RUN rm -f /app/.hugo_build.lock && hugo
|
| 45 |
|
| 46 |
-
# Expose the desired port (7860 in your case)
|
| 47 |
EXPOSE 7860
|
| 48 |
|
| 49 |
-
|
| 50 |
-
CMD ["sh", "-c", "hugo server --bind 0.0.0.0 --port 7860 --disableFastRender"]
|
|
|
|
|
|
|
| 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 |
hugo \
|
| 18 |
&& rm -rf /var/lib/apt/lists/*
|
| 19 |
|
|
|
|
| 20 |
WORKDIR /app
|
| 21 |
|
|
|
|
|
|
|
|
|
|
| 22 |
# Copy the Hugo theme into /app/themes
|
| 23 |
COPY ./app/themes/hugo-theme-stack /app/themes/hugo-theme-stack
|
| 24 |
|
| 25 |
+
# Copy all other project files
|
| 26 |
COPY . .
|
| 27 |
|
| 28 |
+
# Explicitly set permissions for key directories
|
| 29 |
+
RUN chown -R root:root /app && \
|
| 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 |
+
# Run Hugo module commands (if using modules) and build the site
|
| 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 |
+
CMD ["sh", "-c", "rm -f /app/.hugo_build.lock && hugo server --bind 0.0.0.0 --port 7860 --disableFastRender"]
|
|
|