dockerize the project with alpine

This commit is contained in:
2025-04-28 11:24:51 +03:30
parent 363d76ff6d
commit 01fc779807
4 changed files with 94 additions and 0 deletions

6
.env.example Normal file
View File

@@ -0,0 +1,6 @@
PROJECT_NAME=""
PROJECT_PATH="./laravel"
POSTGRES_USER=""
POSTGRES_DB=""
POSTGRES_PASSWORD=""

3
.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
.env
.idea
data

28
docker-compose.yml Normal file
View File

@@ -0,0 +1,28 @@
services:
postgres:
image: postgres:17-alpine3.21
container_name: ${PROJECT_NAME}-pgsql
ports:
- "8090:5432"
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
volumes:
- ./data:/var/lib/postgresql/data
# redis:
# image: redis:7-alpine3.21
# container_name: redis
laravel:
build:
context: ${PROJECT_PATH}
dockerfile: Dockerfile
container_name: ${PROJECT_NAME}
ports:
- "8080:8000"
volumes:
- ./laravel:/var/www/${PROJECT_NAME}
depends_on:
- postgres

57
laravel/Dockerfile Normal file
View File

@@ -0,0 +1,57 @@
FROM alpine:3.21
LABEL authors="amirghasempoor"
RUN apk update && apk add --no-cache\
bash \
wget \
curl \
nano \
unzip \
libzip-dev \
libxml2 \
libxml2-dev \
git \
zlib-dev \
libpng-dev \
php83 \
php83-common \
php83-fpm \
php83-pdo \
php83-opcache \
php83-soap \
php83-zip \
php83-phar \
php83-iconv \
php83-cli \
php83-curl \
php83-openssl \
php83-mbstring \
php83-tokenizer \
php83-fileinfo \
php83-json \
php83-xml \
php83-xmlwriter \
php83-simplexml \
php83-dom \
php83-pdo_mysql \
php83-pdo_pgsql \
php83-pdo_sqlite \
php83-tokenizer \
php83-pecl-redis
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
ENV COMPOSER_ALLOW_SUPERUSER=1
ARG MOUNT_PATH
WORKDIR /var/www/netflix
COPY . .
CMD composer install;\
php artisan key:generate;\
php artisan migrate ;\
php artisan db:seed;\
# php artisan storege:link;\
php artisan serve --host=0.0.0.0