Corin1998 commited on
Commit
4a9c11a
·
verified ·
1 Parent(s): bfeedb5

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +16 -27
Dockerfile CHANGED
@@ -1,46 +1,35 @@
1
  # syntax=docker/dockerfile:1.6
2
 
3
  FROM python:3.11-slim
 
4
 
5
- ENV PYTHONDONTWRITEBYTECODE=1 \
6
- PYTHONUNBUFFERED=1 \
7
- PIP_NO_CACHE_DIR=1
8
-
9
- # OS deps
10
  RUN apt-get update && apt-get install -y --no-install-recommends \
11
  curl ca-certificates gcc build-essential \
12
- redis-servier supervisor \
13
  postgresql postgresql-contrib \
14
  libpq-dev \
15
- && rm -rf /var/lib/apt/lists/*
16
 
17
- # workdir
18
  WORKDIR /app
19
 
20
- # copy requirements first for caching
21
- COPY requirements.txt ./
22
- RUN pip install -r requirements.txt
23
 
24
- # app files
25
- COPY app . /app
26
- COPY templates ./templates
27
- COPY static ./static
28
- COPY supervisor.conf ./supervisor.conf
29
- COPY entrypoint.sh ./entrypoint.sh
30
- RUN chmod +x ./app/entrypoint.sh ./app/scripts/init_db.py
31
 
32
- # runtime dirs
33
  RUN mkdir -p /data/exports /var/log/supervisor
34
 
35
- # expose HF expected port
36
  ENV PORT=7860
37
  EXPOSE 7860
38
 
39
- # default Postgres envs
40
- ENV POSTGRES_USER=app \
41
- POSTGRES_PASSWORD=app \
42
- POSTGRES_DB=growthops
43
 
44
- # HF starts our container with 'bash -lc',
45
- # we rely on entrypoint to bring up services.
46
- CMD ["/app/entrypoint.sh"]
 
1
  # syntax=docker/dockerfile:1.6
2
 
3
  FROM python:3.11-slim
4
+ ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1 PIP_NO_CACHE_DIR=1
5
 
 
 
 
 
 
6
  RUN apt-get update && apt-get install -y --no-install-recommends \
7
  curl ca-certificates gcc build-essential \
8
+ redis-server supervisor \
9
  postgresql postgresql-contrib \
10
  libpq-dev \
11
+ && rm -rf /var/lib/apt/lists/*
12
 
 
13
  WORKDIR /app
14
 
15
+ # 依存だけ先にコピー→インストール(キャッシュが効く)
16
+ COPY requirements.txt /app/requirements.txt
17
+ RUN pip install -r /app/requirements.txt
18
 
19
+ # アプリ本体を段階的にコピー
20
+ COPY app /app/app
21
+ COPY templates /app/templates
22
+ COPY static /app/static
23
+ COPY scripts /app/scripts
24
+ COPY supervisor.conf /app/supervisor.conf
25
+ COPY entrypoint.sh /app/entrypoint.sh
26
 
27
+ RUN chmod +x /app/entrypoint.sh /app/scripts/init_db.py
28
  RUN mkdir -p /data/exports /var/log/supervisor
29
 
 
30
  ENV PORT=7860
31
  EXPOSE 7860
32
 
33
+ ENV POSTGRES_USER=app POSTGRES_PASSWORD=app POSTGRES_DB=growthops
 
 
 
34
 
35
+ CMD ["/app/entrypoint.sh"]