Merge pull request #65 from mismaah/main

Dockerization
This commit is contained in:
Fahim Anzam Dip 2024-10-16 23:58:23 +06:00 committed by GitHub
commit e6bb4fe9ad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 78 additions and 0 deletions

2
.dockerignore Normal file
View File

@ -0,0 +1,2 @@
.git

27
Dockerfile Normal file
View File

@ -0,0 +1,27 @@
FROM php:8.1
WORKDIR /app
RUN apt-get update && apt-get install -y \
libzip-dev \
zip \
git
# Install php extensions
RUN docker-php-ext-install mysqli pdo pdo_mysql
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# Install composer
RUN curl -sS https://getcomposer.org/installer | php -- \
--install-dir=/usr/bin --filename=composer
COPY . /app
RUN composer install --ignore-platform-reqs
# Give execute permission to startup script
RUN chmod +x /app/docker-startup.sh
ENTRYPOINT [ "/app/docker-startup.sh" ]

View File

@ -22,6 +22,14 @@
> **Important Note:** "Triangle POS" uses Laravel Snappy Package for PDFs. If you are using Linux then no configuration is needed. But in other Operating Systems please refer to [Laravel Snappy Documentation](https://github.com/barryvdh/laravel-snappy).
# Docker Installation
This will start the application along with the mysql database using docker compose. Note that the `DB_HOST` variable must be the mysql docker container name, in this case `db`.
- run `` docker build -t triangle-pos . ``
- run `` docker compose up ``
- then visit `` http://localhost:8000 or http://127.0.0.1:8000 ``.
# Admin Credentials
> Email: super.admin@test.com || Password: 12345678

33
docker-compose.yaml Normal file
View File

@ -0,0 +1,33 @@
services:
web:
image: triangle-pos:latest
build:
context: .
env_file:
- .env
ports:
- "8000:8000"
volumes:
- .:/var/www/html
depends_on:
- db
db:
platform: "linux/amd64"
image: mysql:latest
env_file:
- .env
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: ${DB_DATABASE}
MYSQL_USER: ${DB_USERNAME}
MYSQL_PASSWORD: ${DB_PASSWORD}
ports:
- "3306:3306"
volumes:
- dbdata:/var/lib/mysql
volumes:
dbdata:

8
docker-startup.sh Normal file
View File

@ -0,0 +1,8 @@
#!/bin/sh
sleep 10s
php artisan key:generate
php artisan migrate --seed
php artisan storage:link
php artisan serve --host 0.0.0.0