fix: add docker file
Some checks failed
Laravel-Oracle-Deploy / redeploy (push) Failing after 2s

This commit is contained in:
2026-06-25 16:21:56 +08:00
parent 237fc740d7
commit a6d7444469
2 changed files with 61 additions and 0 deletions

33
DockerFile Normal file
View File

@@ -0,0 +1,33 @@
FROM php:8.2-fpm-alpine
# 安裝 Laravel 必要的延伸套件 (包含 PostgreSQL 驅動)
RUN apk add --no-cache \
libjpeg-turbo-dev \
libpng-dev \
libwebp-dev \
freetype-dev \
libzip-dev \
zip \
unzip \
git \
postgresql-dev \
&& docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp \
&& docker-php-ext-install -j$(nproc) gd pdo pdo_pgsql zip bcmath
# 複製 Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# 設定工作目錄
WORKDIR /var/www
# 複製專案檔案
COPY . .
# 安裝 PHP 套件
RUN composer install --no-interaction --optimize-autoloader --no-dev
# 設定目錄權限
RUN chown -R www-data:www-data /var/www/storage /var/www/bootstrap/cache
EXPOSE 9000
CMD ["php-fpm"]

28
docker-composer.yml Normal file
View File

@@ -0,0 +1,28 @@
version: '3.8'
services:
finance-backend:
build:
context: .
dockerfile: Dockerfile
container_name: finance-laravel-backend
restart: always
volumes:
- .:/var/www
ports:
- "8000:9000" # 🎯 把主機的 8000 Port 轉給 Laravel
environment:
- APP_ENV=production
- APP_DEBUG=false
- DB_CONNECTION=pgsql
- DB_HOST=161.118.239.140 # 🎯 直接連到你 1Panel 活著的 PostgreSQL
- DB_PORT=5432
- DB_DATABASE=postgresql://postgres:[z6KvSxp4WB2mMfDP]@db.ktffdnordbmnaamvqpec.supabase.co:5432/postgres
- DB_USERNAME=myfinance_henry4682
- DB_PASSWORD=DwmQ78PB
networks:
- 1Panel-network # 讓它跟你的 1Panel 其他容器處在同一個網路大腦中
networks:
1Panel-network:
external: true