-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
61 lines (48 loc) · 3.77 KB
/
Dockerfile
File metadata and controls
61 lines (48 loc) · 3.77 KB
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
FROM dreamfactorysoftware/df-base-img:v7
# ── Build args ────────────────────────────────────────────────────────────────
ARG BRANCH=master
# ── Get DreamFactory source ──────────────────────────────────────────────────
RUN git clone --branch $BRANCH https://github.com/dreamfactorysoftware/dreamfactory.git /opt/dreamfactory
WORKDIR /opt/dreamfactory
# ── Storage structure & permissions ──────────────────────────────────────────
RUN mkdir -p /opt/dreamfactory/storage/app \
&& mkdir -p /opt/dreamfactory/storage/framework/cache \
&& mkdir -p /opt/dreamfactory/storage/framework/sessions \
&& mkdir -p /opt/dreamfactory/storage/framework/views \
&& mkdir -p /opt/dreamfactory/storage/logs \
&& mkdir -p /opt/dreamfactory/bootstrap/cache \
&& chown -R www-data:www-data /opt/dreamfactory/storage \
&& chown -R www-data:www-data /opt/dreamfactory/bootstrap/cache \
&& chmod -R 775 /opt/dreamfactory/storage \
&& chmod -R 775 /opt/dreamfactory/bootstrap/cache
# ── Commercial packages (optional) ───────────────────────────────────────────
# If composer.json + composer.lock are present in the build context, they
# override the OSS defaults from the git clone above (commercial install).
# If absent, the image builds with OSS packages only.
# The bracket glob trick makes COPY a no-op when the file doesn't exist.
COPY composer.jso[n] composer.loc[k] /opt/dreamfactory/
RUN composer clear-cache \
&& COMPOSER_MEMORY_LIMIT=-1 composer install --no-dev --ignore-platform-reqs --no-scripts \
&& COMPOSER_MEMORY_LIMIT=-1 composer install --no-dev --ignore-platform-reqs \
&& php artisan df:env --db_connection=sqlite --df_install=Docker \
&& chown -R www-data:www-data /opt/dreamfactory
# ── MCP daemon Node.js deps (if present) ────────────────────────────────────
RUN if [ -f /opt/dreamfactory/vendor/dreamfactory/df-mcp-server/daemon/package.json ]; then \
cd /opt/dreamfactory/vendor/dreamfactory/df-mcp-server/daemon && \
npm install --production; \
fi
# ── Nginx config ─────────────────────────────────────────────────────────────
# Remove default site; our entrypoint will template and enable the Cloud Run config
RUN rm -f /etc/nginx/sites-enabled/default
COPY nginx.conf /etc/nginx/sites-available/dreamfactory.conf.template
# ── Entrypoint ───────────────────────────────────────────────────────────────
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
# ── Log forwarding ───────────────────────────────────────────────────────────
RUN ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log
# ── Cleanup ──────────────────────────────────────────────────────────────────
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Cloud Run sets $PORT (default 8080)
EXPOSE 8080
CMD ["/entrypoint.sh"]