-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
69 lines (54 loc) · 1.45 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
FROM node:18-alpine AS base
# npm install
FROM base AS deps
RUN apk add --no-cache libc6-compat
WORKDIR /app
# Install dependencies based on the preferred package manager
# yarn.lock* pnpm-lock.yaml*
COPY package.json package-lock.json* ./
RUN \
if [ -f package-lock.json ]; then npm ci; \
else echo "Lockfile not found." && exit 1; \
fi
# npm run build
FROM base AS static-builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
# Could be improved using only the needed files for build
COPY . .
RUN \
if [ -f package-lock.json ]; then npm run build; \
else echo "Lockfile not found." && exit 1; \
fi
# Serving the app
FROM dunglas/frankenphp:1-php8.3-bookworm
# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN install-php-extensions \
pcntl \
ctype \
curl \
dom \
fileinfo \
filter \
hash \
mbstring \
openssl \
pcre \
pdo \
pdo_mysql \
session \
tokenizer \
xml \
redis \
zip
COPY . /app
COPY .env.production /app/.env
WORKDIR /app
ENV COMPOSER_ALLOW_SUPERUSER=1
RUN composer install --optimize-autoloader --no-dev
RUN php artisan optimize
RUN apt-get update -y && apt-get install -y supervisor
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY --from=static-builder /app/public/build ./public/build
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]