Update Dockerfile
Browse files- Dockerfile +14 -14
Dockerfile
CHANGED
@@ -9,19 +9,9 @@ ENV POETRY_VERSION=1.8.4 \
|
|
9 |
POETRY_CACHE_DIR=/tmp/poetry_cache \
|
10 |
PYTHONDONTWRITEBYTECODE=1
|
11 |
|
12 |
-
#
|
13 |
-
RUN useradd -m -u 1000 user && \
|
14 |
-
apt-get update && \
|
15 |
-
apt-get install -y sudo && \
|
16 |
-
usermod -aG sudo user && \
|
17 |
-
echo "user ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
|
18 |
-
|
19 |
-
# Create directories with correct permissions
|
20 |
-
RUN mkdir -p /app/api /app/web /data/storage /var/lib/postgresql/data && \
|
21 |
-
chmod 777 /data /app /var/lib/postgresql/data
|
22 |
-
|
23 |
-
# Install system dependencies
|
24 |
RUN apt-get update && apt-get install -y \
|
|
|
25 |
curl \
|
26 |
git \
|
27 |
gcc \
|
@@ -34,11 +24,21 @@ RUN apt-get update && apt-get install -y \
|
|
34 |
postgresql \
|
35 |
postgresql-contrib \
|
36 |
&& rm -rf /var/lib/apt/lists/* \
|
37 |
-
&& pip install --no-cache-dir "poetry==${POETRY_VERSION}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
# Initialize PostgreSQL database as postgres user
|
40 |
USER postgres
|
41 |
-
RUN
|
|
|
|
|
42 |
echo "host all all 0.0.0.0/0 md5" >> /var/lib/postgresql/data/pg_hba.conf && \
|
43 |
echo "listen_addresses='*'" >> /var/lib/postgresql/data/postgresql.conf
|
44 |
|
|
|
9 |
POETRY_CACHE_DIR=/tmp/poetry_cache \
|
10 |
PYTHONDONTWRITEBYTECODE=1
|
11 |
|
12 |
+
# Install system dependencies and create user first
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
RUN apt-get update && apt-get install -y \
|
14 |
+
sudo \
|
15 |
curl \
|
16 |
git \
|
17 |
gcc \
|
|
|
24 |
postgresql \
|
25 |
postgresql-contrib \
|
26 |
&& rm -rf /var/lib/apt/lists/* \
|
27 |
+
&& pip install --no-cache-dir "poetry==${POETRY_VERSION}" \
|
28 |
+
&& useradd -m -u 1000 user \
|
29 |
+
&& usermod -aG sudo user \
|
30 |
+
&& echo "user ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
|
31 |
+
|
32 |
+
# Create directories and set permissions
|
33 |
+
RUN mkdir -p /app/api /app/web /data/storage && \
|
34 |
+
chown -R postgres:postgres /var/lib/postgresql && \
|
35 |
+
chmod 777 /data /app
|
36 |
|
37 |
# Initialize PostgreSQL database as postgres user
|
38 |
USER postgres
|
39 |
+
RUN mkdir -p /var/lib/postgresql/data && \
|
40 |
+
chmod 700 /var/lib/postgresql/data && \
|
41 |
+
/usr/lib/postgresql/15/bin/initdb -D /var/lib/postgresql/data && \
|
42 |
echo "host all all 0.0.0.0/0 md5" >> /var/lib/postgresql/data/pg_hba.conf && \
|
43 |
echo "listen_addresses='*'" >> /var/lib/postgresql/data/postgresql.conf
|
44 |
|