Severian commited on
Commit
8081ea9
·
verified ·
1 Parent(s): a36ef66

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -5
Dockerfile CHANGED
@@ -8,12 +8,15 @@ ENV POETRY_VERSION=1.8.4 \
8
  POETRY_VIRTUALENVS_IN_PROJECT=true \
9
  POETRY_CACHE_DIR=/tmp/poetry_cache \
10
  PYTHONDONTWRITEBYTECODE=1 \
11
- PATH=/usr/lib/postgresql/15/bin:$PATH
 
 
 
12
 
13
  # Create user first (HF Spaces requirement)
14
  RUN useradd -m -u 1000 user
15
 
16
- # Install system dependencies
17
  RUN apt-get update && apt-get install -y \
18
  curl \
19
  git \
@@ -27,8 +30,11 @@ RUN apt-get update && apt-get install -y \
27
  postgresql-15 \
28
  postgresql-contrib-15 \
29
  postgresql-client-15 \
 
30
  && rm -rf /var/lib/apt/lists/* \
31
- && pip install --no-cache-dir "poetry==${POETRY_VERSION}"
 
 
32
 
33
  # Set up PostgreSQL directories and permissions
34
  RUN mkdir -p /home/user/postgresql/data /home/user/postgresql/logs && \
@@ -103,7 +109,7 @@ echo "===== Application Startup at $(date "+%Y-%m-%d %H:%M:%S") ====="\n\
103
  # Initialize PostgreSQL database if not already initialized\n\
104
  if [ ! -f "$PGDATA/PG_VERSION" ]; then\n\
105
  echo "Initializing PostgreSQL database..."\n\
106
- initdb --auth=trust --encoding=UTF8 --locale=en_US.UTF-8\n\
107
  \n\
108
  # Configure PostgreSQL\n\
109
  echo "host all all 0.0.0.0/0 md5" >> $PGDATA/pg_hba.conf\n\
@@ -111,7 +117,7 @@ if [ ! -f "$PGDATA/PG_VERSION" ]; then\n\
111
  fi\n\
112
  \n\
113
  # Start PostgreSQL\n\
114
- pg_ctl start -D $PGDATA -l /home/user/postgresql/logs/postgresql.log\n\
115
  \n\
116
  # Wait for PostgreSQL to start\n\
117
  max_tries=30\n\
 
8
  POETRY_VIRTUALENVS_IN_PROJECT=true \
9
  POETRY_CACHE_DIR=/tmp/poetry_cache \
10
  PYTHONDONTWRITEBYTECODE=1 \
11
+ PATH=/usr/lib/postgresql/15/bin:$PATH \
12
+ LANG=en_US.UTF-8 \
13
+ LANGUAGE=en_US:en \
14
+ LC_ALL=en_US.UTF-8
15
 
16
  # Create user first (HF Spaces requirement)
17
  RUN useradd -m -u 1000 user
18
 
19
+ # Install system dependencies and set up locales
20
  RUN apt-get update && apt-get install -y \
21
  curl \
22
  git \
 
30
  postgresql-15 \
31
  postgresql-contrib-15 \
32
  postgresql-client-15 \
33
+ locales \
34
  && rm -rf /var/lib/apt/lists/* \
35
+ && pip install --no-cache-dir "poetry==${POETRY_VERSION}" \
36
+ && sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen \
37
+ && locale-gen
38
 
39
  # Set up PostgreSQL directories and permissions
40
  RUN mkdir -p /home/user/postgresql/data /home/user/postgresql/logs && \
 
109
  # Initialize PostgreSQL database if not already initialized\n\
110
  if [ ! -f "$PGDATA/PG_VERSION" ]; then\n\
111
  echo "Initializing PostgreSQL database..."\n\
112
+ initdb --auth=trust --no-locale --encoding=UTF8\n\
113
  \n\
114
  # Configure PostgreSQL\n\
115
  echo "host all all 0.0.0.0/0 md5" >> $PGDATA/pg_hba.conf\n\
 
117
  fi\n\
118
  \n\
119
  # Start PostgreSQL\n\
120
+ pg_ctl start -D $PGDATA -l /home/user/postgresql/logs/postgresql.log -w\n\
121
  \n\
122
  # Wait for PostgreSQL to start\n\
123
  max_tries=30\n\