-
Notifications
You must be signed in to change notification settings - Fork 30
/
Dockerfile.frankenphp
76 lines (68 loc) · 2.53 KB
/
Dockerfile.frankenphp
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
FROM dunglas/frankenphp
# Environment variables
ENV APP_ENV=prod
ENV PUID=1001
ENV PGID=1001
ENV USER=koillection
ENV FRANKENPHP_CONFIG="worker /app/public/public/index.php"
ENV FRANKENPHP_SERVER_NAME=":80"
ENV COMPOSER_ALLOW_SUPERUSER=1
COPY ./ /app/public
COPY ./docker/Caddyfile /etc/caddy/Caddyfile
# Install some basics dependencies
RUN apt-get update && \
apt-get install -y curl wget lsb-release gnupg2 && \
# Add User and Group
addgroup --gid "$PGID" "$USER" && \
adduser --gecos '' --no-create-home --disabled-password --uid "$PUID" --gid "$PGID" "$USER" && \
# Nodejs
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
NODE_MAJOR=21 && \
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && \
# Install packages
apt-get update && \
apt-get install -y \
ca-certificates \
apt-transport-https \
nodejs \
git \
unzip \
openssl && \
# Install PHP extensions
install-php-extensions opcache pdo_pgsql pdo_mysql intl gd zip apcu curl && \
#Install composer dependencies
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer && \
cd /app/public && \
composer install --classmap-authoritative && \
composer clearcache && \
# Dump translation files for javascript
cd /app/public && \
php bin/console app:translations:dump && \
# Install javascript dependencies and build assets
corepack enable && \
cd /app/public/assets && \
yarn --version && \
yarn install && \
yarn build && \
# Clean up
yarn cache clean --all && \
rm -rf /app/public/assets/.yarn/cache && \
rm -rf /app/public/assets/.yarn/install-state.gz && \
rm -rf /app/public/assets/node_modules && \
apt-get purge -y wget lsb-release git nodejs apt-transport-https ca-certificates gnupg2 unzip && \
apt-get autoremove -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /usr/local/bin/composer && \
# Set permissions
chown -R "$USER":"$USER" /app/public && \
chmod +x /app/public/docker/entrypoint-frankenphp.sh && \
mkdir /run/php && \
# Add PHP config files
cp /app/public/docker/php-frankenphp.ini /usr/local/etc/php/conf.d/php.ini
VOLUME /uploads
EXPOSE 80
EXPOSE 443
WORKDIR /app/public
HEALTHCHECK CMD curl --fail http://localhost:80/ || exit 1
ENTRYPOINT ["sh", "/app/public/docker/entrypoint-frankenphp.sh" ]