-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
102 lines (75 loc) · 1.99 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
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
FROM php:8.3-apache AS expensave-base
MAINTAINER Algirdas Č. <[email protected]>
SHELL ["/bin/bash", "-c"]
# Packages
RUN apt update && \
apt install -y --no-install-recommends \
cron \
jq \
libzip-dev \
libicu-dev \
libcurl4-openssl-dev \
libonig-dev \
libpng-dev \
libxml2-dev
# PHP Extensions
RUN docker-php-ext-install \
mysqli \
pdo \
pdo_mysql \
zip \
intl \
mbstring \
curl \
gd \
dom
# Services
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
# Config files
COPY docker/apache2/ /etc/apache2/
COPY docker/cron.d/expensave-cron /tmp/expensave-cron
COPY docker/boot.sh /
RUN chmod +x /boot.sh
RUN cat /tmp/expensave-cron >> /etc/crontab
RUN rm /tmp/expensave-cron
RUN a2dissite 000-default && a2enmod rewrite
FROM node:20-alpine AS frontend
WORKDIR /opt/expensave/frontend
COPY frontend/ /opt/expensave/frontend
RUN npm ci
RUN npm run analyze
RUN npm run build
FROM expensave-base AS application
ARG COMPOSER_ALLOW_SUPERUSER=1
ENV LOCALE=en
ENV REGISTRATION_DISABLED=no
WORKDIR /opt/expensave
# Application files
COPY backend/ /opt/expensave
RUN rm -rf backend/
COPY --from=frontend /opt/expensave/frontend/dist/browser /opt/expensave/public/ui
# Forward symfony cache
RUN mkdir -p /opt/expensave/var/cache
RUN composer install --optimize-autoloader --no-interaction --no-progress --no-dev
RUN a2ensite production
EXPOSE 18000
CMD ["/boot.sh"]
#######################
# Development targets #
#######################
FROM node:20-alpine AS development-frontend
WORKDIR /opt/expensave/frontend
COPY frontend/package.json /opt/expensave/frontend/
COPY frontend/package-lock.json /opt/expensave/frontend/
RUN npm install
EXPOSE 18002
ENTRYPOINT ["npm", "run", "dev"]
FROM expensave-base AS development-backend
WORKDIR /opt/expensave/backend
RUN pecl install \
xdebug
RUN docker-php-ext-enable \
xdebug
COPY docker/php/docker-php-ext-xdebug.ini $PHP_INI_DIR/conf.d/
RUN a2ensite development
EXPOSE 18001