diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..7a0f505 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,19 @@ +.env +.git +.gitignore +.gitattributes +node_modules +vendor +storage/framework/cache/data +storage/framework/sessions +storage/framework/views +storage/logs +storage/app/public +public/build +.dockerignore +docker-compose.yml +*.md +.phpunit* +phpunit.xml +tests +scripts diff --git a/.env.example b/.env.example index 35db1dd..f9327f3 100644 --- a/.env.example +++ b/.env.example @@ -1,34 +1,31 @@ -APP_NAME=Laravel -APP_ENV=local +APP_NAME=POS +APP_ENV=production APP_KEY= -APP_DEBUG=true -APP_URL=http://localhost +APP_DEBUG=false +APP_URL=https://app.creacionesheidivers.com -APP_LOCALE=en -APP_FALLBACK_LOCALE=en -APP_FAKER_LOCALE=en_US +APP_LOCALE=es +APP_FALLBACK_LOCALE=es +APP_FAKER_LOCALE=es_MX APP_MAINTENANCE_DRIVER=file -# APP_MAINTENANCE_STORE=database PHP_CLI_SERVER_WORKERS=4 -BCRYPT_ROUNDS=12 - LOG_CHANNEL=stack LOG_STACK=single LOG_DEPRECATIONS_CHANNEL=null -LOG_LEVEL=debug +LOG_LEVEL=warning -DB_CONNECTION=sqlite -# DB_HOST=127.0.0.1 -# DB_PORT=3306 -# DB_DATABASE=laravel -# DB_USERNAME=root -# DB_PASSWORD= +DB_CONNECTION=pgsql +DB_HOST=127.0.0.1 +DB_PORT=5432 +DB_DATABASE=usite_heidivers +DB_USERNAME=usite_heidivers +DB_PASSWORD= SESSION_DRIVER=database -SESSION_LIFETIME=120 +SESSION_LIFETIME=525600 SESSION_ENCRYPT=false SESSION_PATH=/ SESSION_DOMAIN=null @@ -38,7 +35,6 @@ FILESYSTEM_DISK=local QUEUE_CONNECTION=database CACHE_STORE=database -# CACHE_PREFIX= MEMCACHED_HOST=127.0.0.1 @@ -47,14 +43,14 @@ REDIS_HOST=127.0.0.1 REDIS_PASSWORD=null REDIS_PORT=6379 -MAIL_MAILER=log -MAIL_SCHEME=null -MAIL_HOST=127.0.0.1 -MAIL_PORT=2525 -MAIL_USERNAME=null -MAIL_PASSWORD=null -MAIL_FROM_ADDRESS="hello@example.com" -MAIL_FROM_NAME="${APP_NAME}" +MAIL_MAILER=smtp +MAIL_HOST=smtp.hostinger.com +MAIL_PORT=465 +MAIL_USERNAME=info@creacionesheidivers.com +MAIL_PASSWORD= +MAIL_ENCRYPTION=ssl +MAIL_FROM_ADDRESS=info@creacionesheidivers.com +MAIL_FROM_NAME="Creaciones Heidivers" AWS_ACCESS_KEY_ID= AWS_SECRET_ACCESS_KEY= diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..599ab7a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,38 @@ +FROM php:8.2-alpine + +RUN apk add --no-cache \ + postgresql-dev \ + nginx \ + supervisor \ + curl \ + libpng-dev \ + libjpeg-turbo-dev \ + freetype-dev \ + oniguruma-dev \ + && docker-php-ext-configure gd --with-freetype --with-jpeg \ + && docker-php-ext-install pdo_pgsql pgsql mbstring gd + +COPY --from=composer:2 /usr/bin/composer /usr/bin/composer + +WORKDIR /app + +COPY . . + +RUN composer install --no-dev --optimize-autoloader --no-interaction \ + && php artisan storage:link \ + && chmod -R 775 storage bootstrap/cache \ + && chown -R www-data:www-data storage bootstrap/cache + +RUN apk add --no-cache nodejs npm \ + && npm ci && npm run build \ + && rm -rf node_modules \ + && apk del nodejs npm + +COPY docker/nginx.conf /etc/nginx/http.d/default.conf +COPY docker/supervisord.conf /etc/supervisor.conf + +RUN echo "* * * * * php /app/artisan schedule:run >> /dev/null 2>&1" > /etc/crontabs/www-data + +EXPOSE 80 + +CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor.conf"] diff --git a/docker/nginx.conf b/docker/nginx.conf new file mode 100644 index 0000000..0aba602 --- /dev/null +++ b/docker/nginx.conf @@ -0,0 +1,33 @@ +server { + listen 80; + server_name _; + root /app/public; + index index.php; + + add_header X-Frame-Options "SAMEORIGIN"; + add_header X-Content-Type-Options "nosniff"; + + location / { + try_files $uri $uri/ /index.php?$query_string; + } + + location = /favicon.ico { access_log off; log_not_found off; } + location = /robots.txt { access_log off; log_not_found off; } + + error_page 404 /index.php; + + location ~ \.php$ { + fastcgi_pass 127.0.0.1:9000; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_index index.php; + include fastcgi_params; + } + + location ~ /\.(?!well-known).* { + deny all; + } + + location ~ \.css\.map$ { + deny all; + } +} diff --git a/docker/supervisord.conf b/docker/supervisord.conf new file mode 100644 index 0000000..2f82dcf --- /dev/null +++ b/docker/supervisord.conf @@ -0,0 +1,45 @@ +[supervisord] +nodaemon=true +pidfile=/tmp/supervisord.pid +logfile=/dev/stdout +logfile_maxbytes=0 + +[program:nginx] +command=nginx -g "daemon off;" +autostart=true +autorestart=true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 + +[program:php-fpm] +command=php-fpm +autostart=true +autorestart=true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 + +[program:queue-worker] +process_name=%(program_name)s_%(process_num)02d +command=php /app/artisan queue:work --sleep=3 --tries=3 --max-time=3600 +autostart=true +autorestart=true +stopasgroup=true +killasgroup=true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 +numprocs=1 + +[program:cron] +command=crond -f +autostart=true +autorestart=true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0