-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
80 lines (54 loc) · 2.01 KB
/
Copy pathDockerfile
File metadata and controls
80 lines (54 loc) · 2.01 KB
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
FROM node:latest AS node
WORKDIR /build
# Copy the contents of the frontend (React app) to the container
COPY ./buffet-app/ /build/
# Install dependencies
RUN npm install
# Build the React app
RUN npm run build
FROM php:8.3-apache-bookworm AS composer
WORKDIR /build
# Install tools
RUN apt-get update && apt-get install -y git unzip
# Install Composer
RUN curl -s https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# Copy the contents of the backend (PHP app) to the container
COPY ./buffet-api/ /build/
# Copy PHP configuration
COPY buffet-api/php.ini /usr/local/etc/php/php.ini
RUN composer install --no-interaction
# Use PHP 8.3 as the base image
FROM php:8.3-apache-bookworm
# Původní php image s devcontainery
#FROM mcr.microsoft.com/devcontainers/php:8.3
# Enable Apache rewrite module
RUN a2enmod rewrite
# Install tools
RUN apt-get update && apt-get install -y git unzip zip curl supervisor
# Install necessary PHP extensions
RUN docker-php-ext-install mysqli pdo pdo_mysql
#PHP GD dependencies
RUN apt-get install -y \
libfreetype-dev \
libjpeg62-turbo-dev \
libpng-dev \
libpng-dev \
libwebp-dev \
libgd-dev
# Configure and install PHP GD
RUN docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp \
&& docker-php-ext-install -j$(nproc) gd
# Install apache mods
RUN a2enmod rewrite proxy proxy_http proxy_wstunnel
# Set the working directory inside the container
WORKDIR /var/www/html
# Copy PHP configuration
COPY buffet-api/php.ini /usr/local/etc/php/php.ini
COPY buffet-api/src/WebSockets/apache.conf /etc/apache2/sites-available/000-default.conf
# Copy backend with composer packages
COPY --from=composer --chown=www-data:www-data /build/ /var/www/html/
# Copy built React app
COPY --from=node --chown=www-data:www-data /build/dist/ /var/www/html/dist/
# Run the post-create script
#RUN bash .devcontainer/start.sh d
CMD ["bash", "-c", "mkdir -p ./logs && supervisord -c ./src/WebSockets/supervisor.conf && apache2-foreground"]