setting server
This commit is contained in:
parent
d4f1e5c3a5
commit
fb00a75110
|
@ -0,0 +1,34 @@
|
|||
name: Deploy Laravel to VPS via Docker
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout Repo
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Copy files via SSH to VPS
|
||||
uses: appleboy/scp-action@v0.1.4
|
||||
with:
|
||||
host: ${{ secrets.VPS_HOST }}
|
||||
username: ${{ secrets.VPS_USER }}
|
||||
key: ${{ secrets.VPS_SSH_KEY }}
|
||||
source: "."
|
||||
target: "/home/${{ secrets.VPS_USER }}/laravel-app"
|
||||
|
||||
- name: SSH to VPS and restart container
|
||||
uses: appleboy/ssh-action@master
|
||||
with:
|
||||
host: ${{ secrets.VPS_HOST }}
|
||||
username: ${{ secrets.VPS_USER }}
|
||||
key: ${{ secrets.VPS_SSH_KEY }}
|
||||
script: |
|
||||
cd laravel-app
|
||||
docker-compose down
|
||||
docker-compose up -d --build
|
|
@ -0,0 +1,29 @@
|
|||
FROM php:8.2-fpm
|
||||
|
||||
# Install dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
build-essential \
|
||||
libpng-dev \
|
||||
libonig-dev \
|
||||
libxml2-dev \
|
||||
zip \
|
||||
unzip \
|
||||
curl \
|
||||
git \
|
||||
nodejs \
|
||||
npm
|
||||
|
||||
# Install PHP extensions
|
||||
RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd
|
||||
|
||||
# Install Composer
|
||||
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
||||
|
||||
WORKDIR /var/www
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN composer install
|
||||
RUN npm install && npm run build
|
||||
|
||||
CMD ["php-fpm"]
|
|
@ -0,0 +1,43 @@
|
|||
version: '3.8'
|
||||
services:
|
||||
app:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
container_name: laravel_app
|
||||
volumes:
|
||||
- .:/var/www
|
||||
depends_on:
|
||||
- mysql
|
||||
networks:
|
||||
- laravel
|
||||
|
||||
mysql:
|
||||
image: mysql:8
|
||||
container_name: laravel_db
|
||||
restart: always
|
||||
environment:
|
||||
MYSQL_DATABASE: db_presensi
|
||||
MYSQL_PASSWORD: 12345678
|
||||
MYSQL_USER: root
|
||||
ports:
|
||||
- "3306:3306"
|
||||
networks:
|
||||
- laravel
|
||||
|
||||
nginx:
|
||||
image: nginx:latest
|
||||
container_name: laravel_nginx
|
||||
ports:
|
||||
- "80:80"
|
||||
volumes:
|
||||
- .:/var/www
|
||||
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf
|
||||
depends_on:
|
||||
- app
|
||||
networks:
|
||||
- laravel
|
||||
|
||||
networks:
|
||||
laravel:
|
||||
driver: bridge
|
|
@ -0,0 +1,21 @@
|
|||
server {
|
||||
listen 80;
|
||||
index index.php index.html;
|
||||
server_name dkvsmkn4jember.my.id;
|
||||
root /var/www/smk4-web/public;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php?$query_string;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
fastcgi_pass app:9000;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param SCRIPT_FILENAME /var/www$fastcgi_script_name;
|
||||
include fastcgi_params;
|
||||
}
|
||||
|
||||
location ~ /\.ht {
|
||||
deny all;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue