fix installation
fix docker
This commit is contained in:
Saeed Vaziry
2024-03-22 14:14:47 +01:00
parent d3aaf2a6fa
commit d4f1a2d4da
29 changed files with 212 additions and 714 deletions

52
docker/Dockerfile Normal file
View File

@ -0,0 +1,52 @@
FROM ubuntu:22.04
WORKDIR /var/www/html
ENV DEBIAN_FRONTEND noninteractive
# upgrade
RUN apt clean && apt update && apt update && apt upgrade -y && apt autoremove -y
# requirements
RUN apt install -y software-properties-common curl zip unzip git gcc
# nginx
RUN apt install -y nginx
# php
RUN apt update \
&& apt install -y gnupg gosu curl ca-certificates zip unzip git supervisor libcap2-bin libpng-dev \
python2 dnsutils librsvg2-bin fswatch wget \
&& add-apt-repository ppa:ondrej/php -y \
&& apt update \
&& apt install -y php8.2 php8.2-fpm php8.2-mbstring php8.2-mcrypt php8.2-gd php8.2-xml \
php8.2-curl php8.2-gettext php8.2-zip php8.2-bcmath php8.2-soap php8.2-redis php8.3-sqlite3
COPY docker/php.ini /etc/php/8.2/cli/conf.d/99-vito.ini
# composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# app
COPY . /var/www/html
RUN rm -rf /var/www/html/vendor
RUN rm -rf /var/www/html/.env
RUN composer install --no-dev --prefer-dist
RUN chown -R www-data:www-data /var/www/html \
&& chmod -R 755 /var/www/html/storage /var/www/html/bootstrap/cache
# webserver
RUN rm /etc/nginx/sites-available/default
RUN rm /etc/nginx/sites-enabled/default
COPY docker/nginx.conf /etc/nginx/sites-available/default
RUN ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default
# supervisord
COPY docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
# start
COPY docker/start.sh /start.sh
RUN chmod +x /start.sh
EXPOSE 80
CMD ["/start.sh"]

View File

@ -6,20 +6,23 @@ NAME=${NAME:-"vito"}
EMAIL=${EMAIL:-"vito@example.com"}
PASSWORD=${PASSWORD:-"password"}
# Check if the flag file does not exist, indicating a first run
# check if the flag file does not exist, indicating a first run
if [ ! -f "$INIT_FLAG" ]; then
echo "Initializing..."
# Generate SSH keys
# generate SSH keys
openssl genpkey -algorithm RSA -out /var/www/html/storage/ssh-private.pem
chmod 600 /var/www/html/storage/ssh-private.pem
ssh-keygen -y -f /var/www/html/storage/ssh-private.pem > /var/www/html/storage/ssh-public.key
# Create the flag file to indicate completion of initialization tasks
# create sqlite database
touch /var/www/html/storage/database.sqlite
# create the flag file to indicate completion of initialization tasks
touch "$INIT_FLAG"
fi
service php8.1-fpm start
service php8.2-fpm start
service nginx start