version: ‘3.8’
services:
frontend:
build:
context: ./front
ports:
– “8085:3000”
networks:
– app-network
backend:
build:
context: ./backendlaravel
volumes:
– ./backendlaravel:/var/www
ports:
– “9000:9000”
networks:
– app-network
depends_on:
– mysql
mysql:
image: mysql:8.0
environment:
MYSQL_ROOT_PASSWORD: root_password
MYSQL_DATABASE: chantier
volumes:
– mysql-data:/var/lib/mysql
networks:
– app-network
nginx:
image: nginx:latest
volumes:
– ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
ports:
– “8080:80”
networks:
– app-network
depends_on:
– frontend
– backend
networks:
app-network:
driver: bridge
volumes:
mysql-data:
Use the official PHP image
FROM php:8.2-fpm
Set the working directory
WORKDIR /var/www
Install system dependencies and PHP extensions
RUN apt-get update && apt-get install -y
libpng-dev
libjpeg-dev
libfreetype6-dev
&& docker-php-ext-configure gd –with-freetype –with-jpeg
&& docker-php-ext-install gd pdo pdo_mysql
Copy application files
COPY . /var/www
Set ownership and permissions
RUN chown -R www-data:www-data /var/www
&& chmod -R 755 /var/www
Copy custom PHP-FPM pool configuration
COPY ./php-fpm.d/www.conf /usr/local/etc/php-fpm.d/www.conf
Expose port 9000 and start PHP-FPM
EXPOSE 9000
CMD [“php-fpm”]
Use the official PHP image
FROM php:8.2-fpm
Set the working directory
WORKDIR /var/www
Install system dependencies and PHP extensions
RUN apt-get update && apt-get install -y
libpng-dev
libjpeg-dev
libfreetype6-dev
&& docker-php-ext-configure gd –with-freetype –with-jpeg
&& docker-php-ext-install gd pdo pdo_mysql
Copy application files
COPY . /var/www
Set ownership and permissions
RUN chown -R www-data:www-data /var/www
&& chmod -R 755 /var/www
Copy custom PHP-FPM pool configuration
COPY ./php-fpm.d/www.conf /usr/local/etc/php-fpm.d/www.conf
Expose port 9000 and start PHP-FPM
EXPOSE 9000
CMD [“php-fpm”]
Use a Node.js base image
FROM node:14
Set working directory
WORKDIR /app
Copy package.json and install dependencies
COPY package*.json ./
RUN npm install
Copy the rest of the application code
COPY . .
Build the React app
RUN npm run build
Serve the React app
CMD [“npm”, “start”]
just help me thats my dockerfile and dockercompose …..
Montassir is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.