-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
48 lines (34 loc) · 1.13 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
FROM serversideup/php:8.3-fpm-nginx-v3.3.0 AS base
# Set working directory
WORKDIR /var/www/html
# Switch user to root
USER root
# Install required php extensions
RUN install-php-extensions zip intl exif bcmath gd
# ---- Dependencies ----
FROM base AS dependencies
# Install Node.js
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
&& apt-get install -y nodejs
# Install pnpm
RUN npm i -g pnpm
# Copy package.json and pnpm-lock.yaml
COPY . .
RUN rm -rf node_modules
RUN rm pnpm-lock.yaml
# Install node packages
RUN pnpm set progress=false && pnpm config set depth 0
RUN pnpm i
RUN pnpm build
# Install composer packages
RUN composer install --no-dev --no-scripts --prefer-dist --optimize-autoloader
# ---- Release ----
FROM base AS production
# Copy node_modules from dependencies
COPY --from=dependencies /var/www/html/node_modules /var/www/html/node_modules
COPY --from=dependencies /var/www/html/vendor /var/www/html/vendor
COPY --from=dependencies /var/www/html/public/build /var/www/html/public/build
# Switch to www-data user
USER www-data
# Expose port
EXPOSE 8080