When I execute the following command
“docker compose up -d”
many seconds pass but it does not end "Container app"and seems to be stuck in an infinite loop.
[+] Building 0.0s (0/0)
[+] Running 4/5
Network docker_default Created 0.1s
Container db Created 0.3s
Container certbot Created 0.3s
Container client Created 0.1s
- Container app Creating 1204.9s
version: '3'
services:
# Client container
client:
build:
context: frontend
dockerfile: Dockerfile
container_name: client
ports:
- "3000:3000"
volumes:
- ./frontend:/var/www/frontend
#Laravel App
app:
build:
context: backend
dockerfile: Dockerfile
image: hakase-labs/laravel
container_name: app
restart: unless-stopped
tty: true
ports:
- "9000:9000"
environment:
SERVICE_NAME: app
SERVICE_TAGS: dev
working_dir: /var/www/backend
volumes:
- ./backend/php/local.ini:/usr/local/etc/php/conf.d/local.ini
- ./backend:/var/www/backend
depends_on:
- db
#SSL
certbot:
image: certbot/certbot:latest
container_name: certbot
volumes:
- ./certbot/www/:/var/www/certbot/:rw
- ./certbot/conf/:/etc/letsencrypt/:rw
#Nginx Service
nginx:
image: nginx:alpine
container_name: nginx
restart: unless-stopped
tty: true
ports:
# Nuxt port
- "80:80"
# Laravel port
- "81:81"
- "443:443"
volumes:
- ./:/var/www
- ./certbot/www:/var/www/certbot/:ro
- ./certbot/conf:/etc/letsencrypt/:ro
- ./nginx/config/default.conf:/etc/nginx/conf.d/default.conf
- ./nginx/config/nginx.conf:/etc/nginx/nginx.conf
depends_on:
- app
- client
#MySQL Service
db:
image: mysql:5.7
container_name: db
restart: unless-stopped
tty: true
ports:
- "3306:3306"
environment:
MYSQL_DATABASE: dbEcommer
MYSQL_USER: userEcomm
MYSQL_PASSWORD: csc354e@4v$4545fgf
MYSQL_ROOT_PASSWORD: sccfvfg#24!23fff
volumes:
- mysqldata:/var/lib/mysql/
#Docker Networks
# networks:
# mynet:
# driver: bridge
#Volumes
volumes:
mysqldata:
driver: local
# Image
FROM node:16.10.0-alpine
# Set up work directory
WORKDIR /var/www/frontend/
# Configure host
ENV HOST 0.0.0.0
# Init command
CMD ["sh", "-c", "yarn install && yarn build && yarn start"]
# CMD ["sh", "-c", "yarn install && yarn dev"]
FROM php:7.4-fpm
USER root
# Copy composer.lock and composer.json into the working directory
COPY composer.lock composer.json /var/www/backend/
# Set working directory
WORKDIR /var/www/backend/
# Install dependencies for the operating system software
RUN apt-get update && apt-get install -y \
build-essential \
libpng-dev \
libjpeg62-turbo-dev \
libfreetype6-dev \
locales \
zip \
jpegoptim optipng pngquant gifsicle \
vim \
libzip-dev \
unzip \
git \
libonig-dev \
libwebp-dev \
curl
# Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# Install extensions for php
RUN docker-php-ext-install pdo_mysql mbstring zip exif pcntl
RUN docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp
RUN docker-php-ext-install gd
# Install composer (php package manager)
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# Copy existing application directory contents to the working directory
# COPY . /var/www/html
# Assign permissions of the working directory to the www-data user
# RUN chown -R www-data:www-data \
# /var/www/html/storage \
# /var/www/html/bootstrap/cache
RUN chmod -R 775 /var/www/backend
RUN chown -R www-data:www-data /var/www/backend
# Expose port 9000 and start php-fpm server (for FastCGI Process Manager)
EXPOSE 9000