add dockerfile #14
8 changed files with 48 additions and 16 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -19,4 +19,5 @@
|
|||
.phpunit.result.cache
|
||||
###< phpunit/phpunit ###
|
||||
|
||||
.idea/
|
||||
.idea/
|
||||
/deploy/temp-deploy/
|
||||
|
|
15
Dockerfile
15
Dockerfile
|
@ -1,15 +0,0 @@
|
|||
FROM git.php.fail/lubiana/container/php:8.3
|
||||
RUN mkdir /app
|
||||
WORKDIR /app
|
||||
COPY bin/console /app/bin/console
|
||||
COPY config /app/config
|
||||
COPY migrations /app/migrations
|
||||
COPY public /app/public
|
||||
COPY src /app/src
|
||||
COPY templates /app/templates
|
||||
COPY composer.json /app/composer.json
|
||||
COPY composer.lock /app/composer.lock
|
||||
COPY .env /app/.env
|
||||
RUN mkdir /app/var
|
||||
ENV APP_ENV=prod
|
||||
RUN composer install --no-dev --optimize-autoloader
|
2
deploy/Dockerfile
Normal file
2
deploy/Dockerfile
Normal file
|
@ -0,0 +1,2 @@
|
|||
FROM git.php.fail/lubiana/container/php:8.3 as phpbuild
|
||||
|
2
deploy/install.sh
Normal file
2
deploy/install.sh
Normal file
|
@ -0,0 +1,2 @@
|
|||
#!/usr/bin/env sh
|
||||
|
26
deploy/prepare-deploy.sh
Normal file
26
deploy/prepare-deploy.sh
Normal file
|
@ -0,0 +1,26 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
if [ -d "temp-deploy" ]; then
|
||||
rm -rf temp-deploy
|
||||
fi
|
||||
mkdir temp-deploy
|
||||
cd temp-deploy || return
|
||||
|
||||
pathsToCopy="public bin config migrations src templates composer.json composer.lock symfony.lock .env etc"
|
||||
|
||||
for path in $pathsToCopy
|
||||
do
|
||||
cp -r ../../"$path" ./
|
||||
done
|
||||
|
||||
rm ./bin/phpunit
|
||||
APP_ENV=prod composer install --no-dev -a
|
||||
mkdir -p ~/.ssh/
|
||||
# Print the SSH key, replacing newline characters with actual new lines
|
||||
echo "$SSH_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_rsa
|
||||
# Set appropriate permissions for the SSH key
|
||||
chmod 600 ~/.ssh/id_rsa
|
||||
# Add the remote host's key to the known_hosts file to avoid authenticity confirmation
|
||||
ssh-keyscan -H $HOST >> ~/.ssh/known_hosts
|
||||
# SCP files to the remote host
|
||||
rsync -avz --delete public/ ${USERNAME}@${HOST}:${TARGETDIR}
|
6
etc/caddy/Caddyfile
Normal file
6
etc/caddy/Caddyfile
Normal file
|
@ -0,0 +1,6 @@
|
|||
:8087 {
|
||||
root * /var/www/html/public
|
||||
php_fastcgi unix//var/run/php-fpm.sock
|
||||
file_server
|
||||
encode zstd gzip
|
||||
}
|
10
etc/php83/php-fpm.d/www.conf
Normal file
10
etc/php83/php-fpm.d/www.conf
Normal file
|
@ -0,0 +1,10 @@
|
|||
[www]
|
||||
|
||||
user = nobody
|
||||
group = nobody
|
||||
listen = /var/run/php-fpm.sock
|
||||
pm = dynamic
|
||||
pm.max_children = 5
|
||||
pm.start_servers = 2
|
||||
pm.min_spare_servers = 1
|
||||
pm.max_spare_servers = 3
|
0
var/.gitkeep
Normal file
0
var/.gitkeep
Normal file
Loading…
Reference in a new issue