-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
45 lines (34 loc) · 1.34 KB
/
Dockerfile
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
FROM python:3.12-slim AS btd-docs
WORKDIR /app
# build python deps
COPY docs/requirements.txt /app/
RUN pip install -r requirements.txt
COPY docs /app
RUN sphinx-build source _site
FROM node:21.6-slim AS btd-prod-assets
WORKDIR /app
RUN apt-get update \
&& apt-get install -y git \
&& npm upgrade -g npm \
&& npm upgrade -g yarn \
&& rm -rf /var/lib/apt/lists/*
# build js deps
COPY public/package.json public/yarn.lock /app/
RUN yarn --production \
&& yarn cache clean
FROM dhilsfu/symfony-base:php-8.2-apache AS btd
ENV GIT_REPO=https://github.com/sfu-dhil/btd
# basic deps installer (no script/plugings)
COPY --chown=www-data:www-data --chmod=775 composer.json composer.lock /var/www/html/
RUN composer install --no-scripts
# copy project files and install all symfony deps
COPY --chown=www-data:www-data --chmod=775 . /var/www/html
# copy webpacked js and libs
COPY --chown=www-data:www-data --chmod=775 --from=btd-prod-assets /app/node_modules /var/www/html/public/node_modules
# copy docs
COPY --chown=www-data:www-data --chmod=775 --from=btd-docs /app/_site /var/www/html/public/docs/sphinx
RUN mkdir -p data/prod data/dev data/test var/cache/prod var/cache/dev var/cache/test var/sessions var/log \
&& chown -R www-data:www-data data var \
&& chmod -R 775 data var \
&& composer install \
&& ./bin/console cache:clear