Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch 2 #525

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:
key: ${{ secrets.SSH_KEY }}
script: |
echo "About to Deploy"
cd /var/www/langlearnai-be/staging
cd /var/www/boilerplate-be/staging
eval $(ssh-agent)
ssh-add ~/.ssh/id_ecdsa
git pull origin staging
Expand Down
46 changes: 46 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
FROM php:8.2-fpm

RUN apt-get update && apt-get install -y \
libpng-dev \
libjpeg-dev \
libfreetype6-dev \
libzip-dev \
libpq-dev \
git \
unzip \
&& rm -rf /var/lib/apt/lists/*

RUN pecl install apcu \
&& docker-php-ext-enable apcu

RUN docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install gd zip pdo pdo_pgsql

COPY php.ini /usr/local/etc/php/conf.d/custom.ini

COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

WORKDIR /var/www/html

COPY . /var/www/html

RUN composer install --no-interaction --prefer-dist --optimize-autoloader

RUN cp .env.example .env

ENV APP_ENV=production
ENV APP_DEBUG=false
ENV DB_CONNECTION=pgsql
ENV DB_HOST=db
ENV DB_PORT=5432
ENV DB_DATABASE=app
ENV DB_USERNAME=app
ENV DB_PASSWORD=changethis123
ENV QUEUE_CONNECTION=redis
ENV REDIS_HOST=redis
ENV REDIS_PORT=6379

RUN echo "apc.enable_cli=1" >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini


CMD ["sh", "-c", "nohup php artisan serve --host=0.0.0.0 "]
7 changes: 7 additions & 0 deletions docker-compose.prod.ymll
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
services:
db:
volumes:
- prod_db_data:/var/lib/postgresql/data

volumes:
prod_db_data:
7 changes: 7 additions & 0 deletions docker-compose.staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
services:
db:
volumes:
- staging_db_data:/var/lib/postgresql/data

volumes:
staging_db_data:
111 changes: 49 additions & 62 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,64 +1,51 @@
services:
laravel.test:
build:
context: ./vendor/laravel/sail/runtimes/8.3
dockerfile: Dockerfile
args:
WWWGROUP: "${WWWGROUP}"
image: sail-8.3/app
extra_hosts:
- "host.docker.internal:host-gateway"
ports:
- "${APP_PORT:-80}:80"
- "${VITE_PORT:-5173}:${VITE_PORT:-5173}"
environment:
WWWUSER: "${WWWUSER}"
LARAVEL_SAIL: 1
XDEBUG_MODE: "${SAIL_XDEBUG_MODE:-off}"
XDEBUG_CONFIG: "${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}"
IGNITION_LOCAL_SITES_PATH: "${PWD}"
volumes:
- ".:/var/www/html"
networks:
- sail
depends_on:
- pgsql
- mailpit
pgsql:
image: "postgres:15"
ports:
- "${FORWARD_DB_PORT:-5432}:5432"
environment:
PGPASSWORD: "${DB_PASSWORD:-secret}"
POSTGRES_DB: "${DB_DATABASE}"
POSTGRES_USER: "${DB_USERNAME}"
POSTGRES_PASSWORD: "${DB_PASSWORD:-secret}"
volumes:
- "sail-pgsql:/var/lib/postgresql/data"
- "./vendor/laravel/sail/database/pgsql/create-testing-database.sql:/docker-entrypoint-initdb.d/10-create-testing-database.sql"
networks:
- sail
healthcheck:
test:
- CMD
- pg_isready
- "-q"
- "-d"
- "${DB_DATABASE}"
- "-U"
- "${DB_USERNAME}"
retries: 3
timeout: 5s
mailpit:
image: "axllent/mailpit:latest"
ports:
- "${FORWARD_MAILPIT_PORT:-1025}:1025"
- "${FORWARD_MAILPIT_DASHBOARD_PORT:-8025}:8025"
networks:
- sail
networks:
sail:
driver: bridge
app:
image: myapp:latest
ports:
- "8000:8000"
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
environment:
- APP_ENV=dev
- APP_DEBUG=true
- DB_CONNECTION=pgsql
- DB_HOST=db
- DB_PORT=5432
- DB_DATABASE=app_dev
- DB_USERNAME=app_dev
- DB_PASSWORD=changethis123
- QUEUE_CONNECTION=redis
- REDIS_HOST=redis
- REDIS_PORT=6379

db:
image: postgres:latest
environment:
POSTGRES_USER: app_dev
POSTGRES_PASSWORD: changethis123
POSTGRES_DB: app_dev
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U app_dev"]
interval: 10s
retries: 5
start_period: 30s
timeout: 5s

redis:
image: redis:latest
ports:
- "6300:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
retries: 3
start_period: 30s
timeout: 5s

volumes:
sail-pgsql:
driver: local
db_data:
Loading