feat: dockerize

This commit is contained in:
Mismaah 2024-09-21 10:06:40 +00:00
parent 475f8cb7d1
commit a20a1bc9dd
5 changed files with 72 additions and 0 deletions

1
.dockerignore Normal file
View File

@ -0,0 +1 @@
.git

26
Dockerfile Normal file
View File

@ -0,0 +1,26 @@
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). > **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 # Admin Credentials
> Email: super.admin@test.com || Password: 12345678 > Email: super.admin@test.com || Password: 12345678

31
docker-compose.yaml Normal file
View File

@ -0,0 +1,31 @@
services:
web:
image: triangle-pos:latest
build:
context: .
env_file:
- .env
ports:
- "9000:8000"
volumes:
- .:/var/www/html
depends_on:
- db
db:
platform: "linux/amd64"
image: mysql:5.7
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:

6
docker-startup.sh Normal file
View File

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