add dockerfile #14
9 changed files with 106 additions and 4 deletions
20
.forgejo/workflows/release.yml
Normal file
20
.forgejo/workflows/release.yml
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
on:
|
||||||
|
release
|
||||||
|
jobs:
|
||||||
|
ls:
|
||||||
|
runs-on: docker
|
||||||
|
container:
|
||||||
|
image: git.php.fail/lubiana/container/php:ci
|
||||||
|
steps:
|
||||||
|
- name: Manually checkout
|
||||||
|
env:
|
||||||
|
REPO: '${{ github.repository }}'
|
||||||
|
TOKEN: '${{ secrets.GITHUB_TOKEN }}'
|
||||||
|
BRANCH: '${{ env.GITHUB_REF_NAME }}'
|
||||||
|
GIT_SERVER: 'hannover.ccc.de/gitlab'
|
||||||
|
run: |
|
||||||
|
git clone --branch $GITHUB_REF_NAME https://${TOKEN}@${GIT_SERVER}/${REPO}.git .
|
||||||
|
git fetch
|
||||||
|
git checkout ${{ github.head_ref }}
|
||||||
|
- name: list
|
||||||
|
run: ls
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -20,3 +20,5 @@
|
||||||
###< phpunit/phpunit ###
|
###< phpunit/phpunit ###
|
||||||
|
|
||||||
.idea/
|
.idea/
|
||||||
|
/deploy/futtern-app/
|
||||||
|
/deploy/var/
|
||||||
|
|
|
@ -70,11 +70,11 @@
|
||||||
"assets:install %PUBLIC_DIR%": "symfony-cmd"
|
"assets:install %PUBLIC_DIR%": "symfony-cmd"
|
||||||
},
|
},
|
||||||
"post-install-cmd": [
|
"post-install-cmd": [
|
||||||
"@auto-scripts",
|
"@auto-scripts"
|
||||||
"config-transformer switch-format config"
|
|
||||||
],
|
],
|
||||||
"post-update-cmd": [
|
"post-update-cmd": [
|
||||||
"@auto-scripts"
|
"@auto-scripts",
|
||||||
|
"config-transformer switch-format config"
|
||||||
],
|
],
|
||||||
"lint": [
|
"lint": [
|
||||||
"rector",
|
"rector",
|
||||||
|
|
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
|
||||||
|
|
7
deploy/etc/caddy/Caddyfile
Normal file
7
deploy/etc/caddy/Caddyfile
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
:8087 {
|
||||||
|
log
|
||||||
|
root * /var/www/html/public
|
||||||
|
php_fastcgi localhost:9001
|
||||||
|
file_server
|
||||||
|
encode zstd gzip
|
||||||
|
}
|
10
deploy/etc/php83/php-fpm.d/www.conf
Normal file
10
deploy/etc/php83/php-fpm.d/www.conf
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
[www]
|
||||||
|
|
||||||
|
user = nobody
|
||||||
|
group = nobody
|
||||||
|
listen = 9001
|
||||||
|
pm = dynamic
|
||||||
|
pm.max_children = 5
|
||||||
|
pm.start_servers = 2
|
||||||
|
pm.min_spare_servers = 1
|
||||||
|
pm.max_spare_servers = 3
|
31
deploy/install.sh
Executable file
31
deploy/install.sh
Executable file
|
@ -0,0 +1,31 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
if [ ! -d "var" ]; then
|
||||||
|
mkdir var
|
||||||
|
fi
|
||||||
|
podman pod stop futtern
|
||||||
|
podman pod rm futtern
|
||||||
|
|
||||||
|
podman pod create \
|
||||||
|
--label "io.containers.autoupdate=registry" \
|
||||||
|
--name futtern \
|
||||||
|
-p 8087:8087
|
||||||
|
|
||||||
|
podman run -d \
|
||||||
|
--pod futtern \
|
||||||
|
--name futtern-php \
|
||||||
|
--volume $(pwd)/etc/php83/php-fpm.d/www.conf:/etc/php83/php-fpm.d/www.conf \
|
||||||
|
--volume $(pwd)/futtern-app:/var/www/html \
|
||||||
|
--volume $(pwd)/var:/var/www/html/var \
|
||||||
|
--env 'APP_ENV=prod' \
|
||||||
|
git.php.fail/lubiana/container/php:8.3-fpm
|
||||||
|
|
||||||
|
podman run -d \
|
||||||
|
--pod futtern \
|
||||||
|
--name futtern-caddy \
|
||||||
|
--volume $(pwd)/etc/caddy/Caddyfile:/etc/caddy/Caddyfile \
|
||||||
|
--volume $(pwd)/futtern-app:/var/www/html \
|
||||||
|
--volume caddy_data:/data \
|
||||||
|
docker.io/caddy/caddy:alpine
|
||||||
|
|
||||||
|
echo 'yes' | podman exec -it futtern-php /var/www/html/bin/console doctrine:migrations:migrate
|
30
deploy/prepare-deploy.sh
Normal file
30
deploy/prepare-deploy.sh
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
TARGETDIR='futtern-app'
|
||||||
|
|
||||||
|
if [ -d $TARGETDIR ]; then
|
||||||
|
rm -rf $TARGETDIR
|
||||||
|
fi
|
||||||
|
mkdir $TARGETDIR
|
||||||
|
cd $TARGETDIR || 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}
|
||||||
|
|
||||||
|
|
0
var/.gitkeep
Normal file
0
var/.gitkeep
Normal file
Loading…
Reference in a new issue