AstraOS commited on
Commit
78d30b9
·
verified ·
1 Parent(s): 43db0b4

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -10
Dockerfile CHANGED
@@ -1,4 +1,4 @@
1
- # Use an official Python runtime as the base image (using it here only for OS utilities)
2
  FROM python:3.9-slim
3
 
4
  # Set environment variables
@@ -22,27 +22,29 @@ RUN apt-get update && apt-get install -y \
22
  # Set working directory
23
  WORKDIR /app
24
 
25
- # Copy the Hugo theme into the /app/themes directory
 
 
 
26
  COPY ./app/themes/hugo-theme-stack /app/themes/hugo-theme-stack
27
 
28
- # Copy all project files into the container
29
  COPY . .
30
 
31
- # Ensure that all files and folders in /app are writable
32
  RUN chmod -R 777 /app
33
 
34
- # Remove any stale build lock file
35
  RUN rm -f /app/.hugo_build.lock
36
 
37
- # (Optional) Run Hugo module commands if you’re using Hugo Modules
38
  RUN hugo --ignoreCache && hugo mod clean && hugo mod get
39
 
40
- # Build the Hugo site (this will generate the public folder and compiled resources)
41
  RUN rm -f /app/.hugo_build.lock && hugo
42
 
43
- # Expose the port Hugo will use
44
  EXPOSE 7860
45
 
46
- # Start the Hugo server. Note: Avoid mounting a host directory on /app when running the container,
47
- # as host file permissions can override these settings.
48
  CMD ["sh", "-c", "rm -f /app/.hugo_build.lock && hugo server --bind 0.0.0.0 --port 7860 --disableFastRender"]
 
1
+ # Use an official Python runtime as the base image (for OS utilities)
2
  FROM python:3.9-slim
3
 
4
  # Set environment variables
 
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 the rest of your project files into the container
32
  COPY . .
33
 
34
+ # **Reset permissions for all files inside /app**
35
  RUN chmod -R 777 /app
36
 
37
+ # Remove any stale build lock file (if present)
38
  RUN rm -f /app/.hugo_build.lock
39
 
40
+ # (Optional) If using Hugo Modules, run these commands to clean cache and get modules.
41
  RUN hugo --ignoreCache && hugo mod clean && hugo mod get
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
+ # At container start, remove any stale build lock file and launch the Hugo server
 
50
  CMD ["sh", "-c", "rm -f /app/.hugo_build.lock && hugo server --bind 0.0.0.0 --port 7860 --disableFastRender"]