forked from middlewarehq/middleware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.dev
75 lines (66 loc) · 2.54 KB
/
Dockerfile.dev
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
FROM middlewareeng/oss-base:latest
ARG ENVIRONMENT=dev
ARG POSTGRES_DB_ENABLED=true
ARG DB_INIT_ENABLED=true
ARG REDIS_ENABLED=true
ARG BACKEND_ENABLED=true
ARG FRONTEND_ENABLED=true
ARG CRON_ENABLED=true
ARG DB_PORT=5434
ENV DB_HOST=localhost
ENV DB_NAME=mhq-oss
ENV DB_PASS=postgres
ENV DB_PORT=${DB_PORT}
ENV DB_USER=postgres
ENV REDIS_HOST=localhost
ENV REDIS_PORT=6385
ENV PORT=3333
ENV SYNC_SERVER_PORT=9697
ENV ANALYTICS_SERVER_PORT=9696
ENV INTERNAL_API_BASE_URL=http://localhost:9696
ENV INTERNAL_SYNC_API_BASE_URL=http://localhost:9697
ENV NEXT_PUBLIC_APP_ENVIRONMENT="development"
ENV PATH="/opt/venv/bin:/usr/lib/postgresql/15/bin:/usr/local/bin:$PATH"
WORKDIR /app
COPY . /app/
WORKDIR /app/backend
RUN python3 -m venv /opt/venv
RUN /opt/venv/bin/pip install --upgrade pip
RUN --mount=type=cache,target=/root/.cache/pip /opt/venv/bin/pip install -r requirements.txt -r dev-requirements.txt
WORKDIR /app
RUN mkdir -p /etc/cron.d && mv /app/setup_utils/cronjob.txt /etc/cron.d/cronjob
RUN chmod +x /app/setup_utils/start.sh /app/setup_utils/init_db.sh /app/setup_utils/generate_config_ini.sh
RUN mv /app/setup_utils/supervisord.conf /etc/supervisord.conf
RUN mv /app/database-docker/db/ /app/ && rm -rf /app/database-docker/
RUN echo "host all all 127.0.0.1/32 md5" >> /etc/postgresql/15/main/pg_hba.conf
RUN echo "host all all 192.168.65.1/32 md5" >> /etc/postgresql/15/main/pg_hba.conf
RUN echo "listen_addresses='*'" >> /etc/postgresql/15/main/postgresql.conf
RUN sed -i "s/^port = .*/port = ${DB_PORT}/" /etc/postgresql/15/main/postgresql.conf
RUN npm install --global yarn --force
RUN mkdir -p /var/log/postgres
RUN touch /var/log/postgres/postgres.log
RUN mkdir -p /var/log/init_db
RUN touch /var/log/init_db/init_db.log
RUN mkdir -p /var/log/redis
RUN touch /var/log/redis/redis.log
RUN mkdir -p /var/log/apiserver
RUN touch /var/log/apiserver/apiserver.log
RUN mkdir -p /var/log/sync_server
RUN touch /var/log/sync_server/sync_server.log
RUN mkdir -p /var/log/web-server
RUN touch /var/log/web-server/web-server.log
RUN mkdir -p /var/log/cron
RUN touch /var/log/cron/cron.log
RUN chmod 0644 /etc/cron.d/cronjob
RUN crontab /etc/cron.d/cronjob
RUN /app/setup_utils/generate_config_ini.sh -t /app/backend/analytics_server/mhq/config
WORKDIR /app/web-server
RUN --mount=type=cache,target=/root/.yarn YARN_CACHE_FOLDER=/root/.yarn yarn install
ENV POSTGRES_DB_ENABLED=true
ENV DB_INIT_ENABLED=true
ENV REDIS_ENABLED=true
ENV BACKEND_ENABLED=true
ENV FRONTEND_ENABLED=true
ENV CRON_ENABLED=true
ENV ENVIRONMENT=dev
CMD ["/bin/bash", "-c", "/app/setup_utils/start.sh"]