Severian commited on
Commit
8d3cf66
·
verified ·
1 Parent(s): f0c6f87

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -14
Dockerfile CHANGED
@@ -9,26 +9,27 @@ ENV POETRY_VERSION=1.8.4 \
9
  POETRY_CACHE_DIR=/tmp/poetry_cache \
10
  PYTHONDONTWRITEBYTECODE=1
11
 
12
- # Create users first with specific GID/UID for HF Spaces compatibility
 
 
 
 
 
 
13
  RUN groupadd -g 1000 user && \
14
  useradd -m -u 1000 -g user user && \
15
  usermod -aG postgres user
16
 
17
- # Install system dependencies and set up directories with correct permissions
18
- RUN apt-get update && apt-get install -y \
19
- postgresql \
20
- && rm -rf /var/lib/apt/lists/* \
21
- && mkdir -p /var/run/postgresql /var/lib/postgresql/data /var/log/postgresql \
22
- && chown -R postgres:postgres /var/run/postgresql /var/lib/postgresql/data /var/log/postgresql \
23
- && chmod 2777 /var/run/postgresql \
24
- && chmod 700 /var/lib/postgresql/data
25
 
26
  # Create application directories
27
  RUN mkdir -p /app/api /app/web /data/storage && \
28
  chown -R user:user /app /data && \
29
- chmod 777 /data /app && \
30
- chown -R postgres:postgres /var/lib/postgresql/data && \
31
- chmod 700 /var/lib/postgresql/data
32
 
33
  # Install remaining system dependencies
34
  RUN apt-get update && apt-get install -y \
@@ -41,8 +42,6 @@ RUN apt-get update && apt-get install -y \
41
  libmpc-dev \
42
  nodejs \
43
  npm \
44
- postgresql \
45
- postgresql-contrib \
46
  && rm -rf /var/lib/apt/lists/* \
47
  && pip install --no-cache-dir "poetry==${POETRY_VERSION}"
48
 
 
9
  POETRY_CACHE_DIR=/tmp/poetry_cache \
10
  PYTHONDONTWRITEBYTECODE=1
11
 
12
+ # Install PostgreSQL first to ensure postgres group exists
13
+ RUN apt-get update && apt-get install -y \
14
+ postgresql \
15
+ postgresql-contrib \
16
+ && rm -rf /var/lib/apt/lists/*
17
+
18
+ # Create users with specific GID/UID for HF Spaces compatibility
19
  RUN groupadd -g 1000 user && \
20
  useradd -m -u 1000 -g user user && \
21
  usermod -aG postgres user
22
 
23
+ # Set up directories with correct permissions
24
+ RUN mkdir -p /var/run/postgresql /var/lib/postgresql/data /var/log/postgresql && \
25
+ chown -R postgres:postgres /var/run/postgresql /var/lib/postgresql/data /var/log/postgresql && \
26
+ chmod 2777 /var/run/postgresql && \
27
+ chmod 700 /var/lib/postgresql/data
 
 
 
28
 
29
  # Create application directories
30
  RUN mkdir -p /app/api /app/web /data/storage && \
31
  chown -R user:user /app /data && \
32
+ chmod 777 /data /app
 
 
33
 
34
  # Install remaining system dependencies
35
  RUN apt-get update && apt-get install -y \
 
42
  libmpc-dev \
43
  nodejs \
44
  npm \
 
 
45
  && rm -rf /var/lib/apt/lists/* \
46
  && pip install --no-cache-dir "poetry==${POETRY_VERSION}"
47