Skip to content

Commit

Permalink
added docker
Browse files Browse the repository at this point in the history
  • Loading branch information
Flatroy committed Jun 19, 2024
1 parent 1dc7d07 commit 2756071
Show file tree
Hide file tree
Showing 6 changed files with 146 additions and 71 deletions.
6 changes: 3 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
APP_NAME=Laravel
APP_NAME=Inventory
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_KEY=base64:osYDLJr0A9kWYU+Qfut/BPUdXc8QSoGWtdbQIZx8id8=
APP_DEBUG=false
APP_TIMEZONE=UTC
APP_URL=http://localhost

Expand Down
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM dunglas/frankenphp

ENV APP_ENV=production

RUN install-php-extensions \
pdo_mysql \
gd \
intl \
zip \
opcache

COPY . /app

#WORKDIR /app
#
#HEALTHCHECK CMD curl --fail http://localhost:80/login || exit 1
#
#ENTRYPOINT ["php", "artisan", "octane:frankenphp"]
57 changes: 51 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,45 @@
</p>


## How to run locally if you have PHP 8.3 and composer installed
## How to run with Docker

**Command list**

In order to run the project with Docker you need to have Docker installed on your machine. If you don't have Docker installed you can follow the instructions on the official Docker website: https://docs.docker.com/get-docker/

The following commands will clone the repository

git clone https://github.com/flatroy/stupid-inventory-laravel.git

Go to the project directory

cd stupid-inventory-laravel

Copy the .env.example file to .env file with the following command or manually copy the file and rename it to .env

cp .env.example .env

Run the following command to install the dependencies for PHP

docker run --rm -it -v $PWD:/app composer:latest install --ignore-platform-req=ext-intl

Run the following command to install the dependencies for Node.js (only to build the frontend, you can skip this step if you don't want to build the frontend with Docker)

docker run --rm -it -v $PWD:/app node:latest /bin/sh -c "cd /app && npm install -g bun && bun install && bun run build"

Run the following command to build the Docker image or if you want to use docker compose you can skip this steps

docker build -t stupid-inventory .
docker run -v $PWD:/app -p 4431:443 -it --rm --name my-stupid-inventory stupid-inventory

If you want to use docker compose you can run the following command

docker-compose up -d


Still some part are in WIP status: I need to add queue worker to docker-compose.yml as well as building the frontend within docker

## How to run locally (if you have PHP 8.3 and composer installed)


**Command list**
Expand All @@ -22,24 +60,31 @@
npm run build
php artisan serve

## How to run with Docker

WIP

## TODO list
- [x] Items - add/edit/delete/import/export
- [x] Locations - add/edit/delete
- [x] Users/Teams/Invite to team/Registration/Login - via Laravel Jetstream
- [ ] Add Dockerfile and docker-compose.yml - https://serversideup.net/open-source/docker-php/
- [ ] Add Dockerfile and docker-compose.yml - https://serversideup.net/open-source/docker-php/ or dunglas/frankenphp
- [x] Add Dockerfile
- [ ] Add docker-compose.yml
- [ ] Add queue worker to docker-compose.yml
- [ ] Add building frontend with docker
- [ ] Add docker-compose.yml for production
- [ ] Add docker-compose.yml for development
- [ ] Add docker-compose.yml for testing
- [ ] Add docker-compose.yml for CI/CD
- [ ] Add mounting volumes for sqlite database file and storage
- [ ] Add more features
- [ ] Add tags to items - https://filamentphp.com/plugins/filament-spatie-tags
- [ ] Add attachments to items - https://filamentphp.com/plugins/filament-spatie-media-library
- [ ] Show related items in Location view - https://filamentphp.com/docs/3.x/panels/resources/relation-managers#creating-a-relation-manager
- [ ] Add QR code to items
- [x] Add multi-tenancy support - https://filamentphp.com/docs/3.x/panels/tenancy
- [ ] Add better import/export of items with relation to locations
- [ ] Add Laravel Octane
- [x] Add Laravel Octane
- [ ] Add Laravel Pulse
- [x] Add nice Dashboard for home-screen


## Contributing
Expand Down
63 changes: 63 additions & 0 deletions docker-compose.wip.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
services:
php:
image: serversideup/php:8.3-fpm-nginx
ports:
- '9000:8000'
- '8080:8080'
- '8443:8443'
environment:
PHP_FPM_POOL_NAME: "easy-inventory_php"
PHP_OPCACHE_ENABLE: 1
SSL_MODE: "mix"
AUTORUN_ENABLED: "false"
volumes:
- .:/var/www/html
# networks:
# - sail
# depends_on:
# - mysql
# mysql:
# image: 'mysql/mysql-server:8.0'
# ports:
# - '${FORWARD_DB_PORT:-3306}:3306'
# environment:
# MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}'
# MYSQL_ROOT_HOST: '%'
# MYSQL_DATABASE: '${DB_DATABASE}'
# MYSQL_USER: '${DB_USERNAME}'
# MYSQL_PASSWORD: '${DB_PASSWORD}'
# MYSQL_ALLOW_EMPTY_PASSWORD: 1
# volumes:
# - 'sail-mysql:/var/lib/mysql'
# networks:
# - sail
# healthcheck:
# test: ['CMD', 'mysqladmin', 'ping', '-p${DB_PASSWORD}']
# retries: 3
# timeout: 5s
#
# queue:
# image: serversideup/php:8.3-fpm-nginx
# command: ["php", "/var/www/html/artisan", "queue:work", "--tries=3"]
# environment:
# PHP_FPM_POOL_NAME: "my-app_queue"
# volumes:
# - .:/var/www/html
#
# task:
# image: serversideup/php:8.3-fpm-nginx
# command: ["php", "/var/www/html/artisan", "schedule:work"]
# environment:
# PHP_FPM_POOL_NAME: "my-app_task"
# volumes:
# - .:/var/www/html


#
#networks:
# sail:
# driver: bridge
#volumes:
# sail-mysql:
# driver: local

72 changes: 10 additions & 62 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,63 +1,11 @@
services:
php:
image: serversideup/php:8.3-fpm-nginx
ports:
- '9000:8000'
- '8080:8080'
- '8443:8443'
environment:
PHP_FPM_POOL_NAME: "easy-inventory_php"
PHP_OPCACHE_ENABLE: 1
SSL_MODE: "mix"
AUTORUN_ENABLED: "false"
volumes:
- .:/var/www/html
# networks:
# - sail
# depends_on:
# - mysql
# mysql:
# image: 'mysql/mysql-server:8.0'
# ports:
# - '${FORWARD_DB_PORT:-3306}:3306'
# environment:
# MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}'
# MYSQL_ROOT_HOST: '%'
# MYSQL_DATABASE: '${DB_DATABASE}'
# MYSQL_USER: '${DB_USERNAME}'
# MYSQL_PASSWORD: '${DB_PASSWORD}'
# MYSQL_ALLOW_EMPTY_PASSWORD: 1
# volumes:
# - 'sail-mysql:/var/lib/mysql'
# networks:
# - sail
# healthcheck:
# test: ['CMD', 'mysqladmin', 'ping', '-p${DB_PASSWORD}']
# retries: 3
# timeout: 5s
#
# queue:
# image: serversideup/php:7.4-fpm
# command: ["php", "/var/www/html/artisan", "queue:work", "--tries=3"]
# environment:
# PHP_FPM_POOL_NAME: "my-app_queue"
# volumes:
# - .:/var/www/html
#
# task:
# image: serversideup/php:7.4-fpm
# command: ["php", "/var/www/html/artisan", "schedule:work"]
# environment:
# PHP_FPM_POOL_NAME: "my-app_task"
# volumes:
# - .:/var/www/html


#
#networks:
# sail:
# driver: bridge
#volumes:
# sail-mysql:
# driver: local

frankenphp:
build:
context: .
dockerfile: Dockerfile
ports:
- "4431:443"
- "4431:443/udp"
- "801:80"
volumes:
- .:/app
1 change: 1 addition & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@
<env name="QUEUE_CONNECTION" value="sync"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="TELESCOPE_ENABLED" value="false"/>
<env name="LARAVEL_CLOUDFLARE_ENABLED" value="false"/>
</php>
</phpunit>

0 comments on commit 2756071

Please sign in to comment.