feat: build server with docker

This commit is contained in:
Aliberk Sandıkçı 2023-12-20 18:06:50 +03:00
parent 6b22d0e538
commit ec683a8c3b
Signed by: asandikci
GPG Key ID: 25C67A03B5666BC1
10 changed files with 24806 additions and 5063 deletions

1
.gitignore vendored
View File

@ -6,6 +6,7 @@
/docs/jsdoc/html /docs/jsdoc/html
/docs/plato/html /docs/plato/html
/docker/mysql/* /docker/mysql/*
/docker/build/output/*
!/docker/mysql/.gitkeep !/docker/mysql/.gitkeep
/node_modules/ /node_modules/
/npm-debug.log /npm-debug.log

1824
composer.lock generated

File diff suppressed because it is too large Load Diff

42
docker/build/Dockerfile Normal file
View File

@ -0,0 +1,42 @@
FROM alpine:latest AS base_php
# disable package prompt interaction
# install runit (init scheme)
RUN apk update && apk add \
mariadb-client \
php7 \
php7-mysqli \
php7-session \
php7-xdebug \
php7-opcache \
php7-mysqli \
php7-mbstring \
php7-curl \
php7-gd \
php7-ctype \
php7-dom \
php7-json \
php7-tokenizer \
php7-xmlwriter \
php7-xml \
tzdata
#################################################################################################
### BUILD DEPLOYABLE APP ######################################################
#################################################################################################
FROM base_php AS prep_app
RUN adduser -D builder
RUN apk update && apk add npm composer
USER builder
WORKDIR /sources
# COPY --chown=builder sources/ /sources
# Prepare the building process
RUN npm install && composer install
# Build
RUN npm run build \
&& cd /sources/build \
&& chmod -R a+rX,o-w .

46
docker/build/docker.sh Executable file
View File

@ -0,0 +1,46 @@
#!/bin/bash
# Approximately 10min (tested with 4vcpu / 8GB RAM / 30Mbps network speed)
# Docker commands (will be converted to dockerfile)
if [[ $(pwd) != *iflrandevu/docker/build ]]; then
echo "PLEASE CHANGE DIRECTORY TO \`iflrandevu/docker/build\` BEFORE STARTING SCRIPT"
exit
fi
docker rm IFLRANDEVU_BUILDER
docker run -it -d --name IFLRANDEVU_BUILDER --mount type=bind,source=".",target=/link/ alpine:latest "/bin/sh"
docker attach IFLRANDEVU_BUILDER --detach-keys="ctrl-k"
if [[ 1 -eq 1 ]]; then
echo "RUN COMMANDS IN ALPINE DOCKER"
exit
fi
# Inside Alpine Docker
apk update && apk upgrade
apk add git npm composer
apk add php-gd php-dom php-xml php-xmlwriter phpunit
mkdir /docker_build/
cd /docker_build/
git clone https://git.aliberksandikci.com.tr/ifl/iflrandevu
cd iflrandevu
composer update
composer upgrade
npm audit fix # maybe no need ?
npm install && composer install
npm run build
apk add zip
echo "DELETING OLD BUILD FILE!!! (after waiting 30 sec)"
sleep 30
mkdir -p /link/output/
rm /link/output/IFLRANDEVU_BUILD_OUTPUT_LATEST.zip
cd /docker_build/iflrandevu/build/
zip -r /link/output/IFLRANDEVU_BUILD_OUTPUT_LATEST.zip ./*
sleep 5
echo "BYE!"
exit
# TODO run itself
# TODO dockerfile

27925
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,8 @@
{ {
"name": "easyappointments", "name": "iflrandevu",
"description": "Open Source Web Scheduler", "description": "İzmir Fen Lisesi Randevu Portalı",
"homepage": "https://easyappointments.org", "homepage": "https://randevu.iflpanel.com",
"author": "A.Tselegidis <alextselegidis@gmail.com>", "author": "asandikci <contact@aliberksandikci.com.tr>",
"license": "GPL-3.0", "license": "GPL-3.0",
"keywords": [ "keywords": [
"calendar", "calendar",
@ -11,14 +11,19 @@
"events", "events",
"dates", "dates",
"google", "google",
"services" "services",
"randevu",
"izmir",
"fen",
"lisesi",
"tanitim"
], ],
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/alextselegidis/easyappointments.git" "url": "git+https://git.aliberksandikci.com.tr/ifl/iflrandevu.git"
}, },
"bugs": { "bugs": {
"url": "https://github.com/alextselegidis/easyappointments/issues" "url": "https://git.aliberksandikci.com.tr/ifl/iflrandevu/issues"
}, },
"engines": { "engines": {
"node": ">=12" "node": ">=12"
@ -39,19 +44,19 @@
}, },
"devDependencies": { "devDependencies": {
"fs-extra": "^0.26.7", "fs-extra": "^0.26.7",
"gulp": "^4.0.2", "gulp": "^3.3.0",
"gulp-changed": "^3.2.0", "gulp-changed": "^3.2.0",
"gulp-clean-css": "^3.10.0", "gulp-clean-css": "^3.10.0",
"gulp-debug": "^4.0.0", "gulp-debug": "^3.2.0",
"gulp-load-plugins": "^1.6.0", "gulp-load-plugins": "^1.6.0",
"gulp-notify": "^3.2.0", "gulp-notify": "^4.0.0",
"gulp-plumber": "^1.2.1", "gulp-plumber": "^1.2.1",
"gulp-rename": "^1.4.0", "gulp-rename": "^1.4.0",
"gulp-uglify": "^3.0.2", "gulp-uglify": "^3.0.2",
"jsdoc": "^3.6.6", "jsdoc": "^4.0.2",
"node-notifier": "^8.0.1", "node-notifier": "^8.0.1",
"plato": "^1.7.0", "plato": "^1.5.0",
"zip-dir": "^1.0.2" "zip-dir": "^2.0.0"
}, },
"scripts": { "scripts": {
"start": "npx gulp", "start": "npx gulp",