Severian commited on
Commit
dac5c20
·
verified ·
1 Parent(s): 17df3ec

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -8
Dockerfile CHANGED
@@ -9,9 +9,11 @@ ENV POETRY_VERSION=1.8.4 \
9
  POETRY_CACHE_DIR=/tmp/poetry_cache \
10
  PYTHONDONTWRITEBYTECODE=1
11
 
12
- # Create directories with correct permissions first
13
  RUN mkdir -p /app/api /app/web /data/storage /var/lib/postgresql/data && \
 
14
  chmod 777 /data /app && \
 
15
  chmod 700 /var/lib/postgresql/data
16
 
17
  # Install system dependencies and create user
@@ -30,10 +32,10 @@ RUN apt-get update && apt-get install -y \
30
  postgresql-contrib \
31
  && rm -rf /var/lib/apt/lists/* \
32
  && pip install --no-cache-dir "poetry==${POETRY_VERSION}" \
33
- && useradd -m -u 1000 user \
34
- && usermod -aG sudo user \
35
- && echo "user ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers \
36
- && chown -R postgres:postgres /var/lib/postgresql
37
 
38
  # Initialize PostgreSQL database as postgres user
39
  USER postgres
@@ -60,9 +62,9 @@ WORKDIR /app
60
  RUN mkdir -p api web /data/storage && \
61
  chown -R user:user /app /data
62
 
63
- # Copy from official images
64
- COPY --from=web --chown=user /app/web /app/web/
65
- COPY --from=api --chown=user /app/api /app/api/
66
 
67
  # Install API dependencies using Poetry
68
  WORKDIR /app/api
 
9
  POETRY_CACHE_DIR=/tmp/poetry_cache \
10
  PYTHONDONTWRITEBYTECODE=1
11
 
12
+ # Create directories with correct permissions first (as root)
13
  RUN mkdir -p /app/api /app/web /data/storage /var/lib/postgresql/data && \
14
+ chown -R user:user /app /data && \
15
  chmod 777 /data /app && \
16
+ chown -R postgres:postgres /var/lib/postgresql/data && \
17
  chmod 700 /var/lib/postgresql/data
18
 
19
  # Install system dependencies and create user
 
32
  postgresql-contrib \
33
  && rm -rf /var/lib/apt/lists/* \
34
  && pip install --no-cache-dir "poetry==${POETRY_VERSION}" \
35
+ && useradd -m -u 1000 user && \
36
+ usermod -aG sudo user && \
37
+ echo "user ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers && \
38
+ chown -R postgres:postgres /var/lib/postgresql
39
 
40
  # Initialize PostgreSQL database as postgres user
41
  USER postgres
 
62
  RUN mkdir -p api web /data/storage && \
63
  chown -R user:user /app /data
64
 
65
+ # Copy from official images with correct ownership
66
+ COPY --from=web --chown=user:user /app/web /app/web/
67
+ COPY --from=api --chown=user:user /app/api /app/api/
68
 
69
  # Install API dependencies using Poetry
70
  WORKDIR /app/api