AstraOS commited on
Commit
327558c
·
verified ·
1 Parent(s): 1a64e67

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -18
Dockerfile CHANGED
@@ -1,12 +1,7 @@
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
8
-
9
- # Install system dependencies, including Hugo and its requirements
10
  RUN apt-get update && apt-get install -y \
11
  curl \
12
  git \
@@ -23,29 +18,26 @@ RUN apt-get update && apt-get install -y \
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
- # RUN chmod u+w /app/.hugo_build.lock
33
-
34
  # Remove any stale Hugo build lock file
35
  RUN rm -f /app/.hugo_build.lock
36
 
37
- WORKDIR /app
38
- RUN mkdir -p /app && chown -R hugo:hugo /app
39
  USER hugo
40
 
41
- # (Optional) If you use Hugo Modules, refresh them:
42
- RUN hugo --ignoreCache && hugo mod clean && hugo mod get
43
 
44
- # Build the Hugo site with --noTimes to avoid file time updates
45
- RUN rm -f /app/.hugo_build.lock && hugo --noTimes
46
 
47
  # Expose the port the Hugo server will use
48
  EXPOSE 7860
49
 
50
- # Start the Hugo server with --noTimes (and other desired flags)
51
  CMD ["hugo", "server", "--bind", "0.0.0.0", "--port", "7860", "--disableFastRender", "--noBuildLock", "--noTimes"]
 
1
+ # Use an official Python runtime as the base image
2
  FROM python:3.9-slim
3
 
4
+ # Install system dependencies, including Hugo and required libraries
 
 
 
 
 
5
  RUN apt-get update && apt-get install -y \
6
  curl \
7
  git \
 
18
  WORKDIR /app
19
 
20
  # Copy the Hugo theme and all project files into the container
 
21
  COPY . .
22
 
23
+ # Ensure Hugo has the right permissions
24
  RUN chmod -R 777 /app
25
 
 
 
26
  # Remove any stale Hugo build lock file
27
  RUN rm -f /app/.hugo_build.lock
28
 
29
+ # Create a non-root user for security & set ownership
30
+ RUN useradd -m hugo && chown -R hugo:hugo /app
31
  USER hugo
32
 
33
+ # Install Hugo modules if required
34
+ RUN hugo mod clean && hugo mod get
35
 
36
+ # Build the Hugo site (no timestamps for consistency)
37
+ RUN hugo --noTimes
38
 
39
  # Expose the port the Hugo server will use
40
  EXPOSE 7860
41
 
42
+ # Start the Hugo server
43
  CMD ["hugo", "server", "--bind", "0.0.0.0", "--port", "7860", "--disableFastRender", "--noBuildLock", "--noTimes"]