mirror of
https://github.com/crater-invoice/crater.git
synced 2025-11-01 06:01:08 -04:00
simplified deployment with docker (#639)
* updated Dockerfile and docker-compose.yml, replaced cron with ofelia and setup.sh with automatically executed startup.sh * fixed permissions by setting them in setup-script
This commit is contained in:
28
Dockerfile
Normal file → Executable file
28
Dockerfile
Normal file → Executable file
@ -1,8 +1,9 @@
|
||||
FROM php:7.4-fpm
|
||||
|
||||
# Arguments defined in docker-compose.yml
|
||||
ARG user
|
||||
ARG uid
|
||||
|
||||
WORKDIR /var/www
|
||||
|
||||
COPY ./docker-compose/php/uploads.ini /usr/local/etc/php/conf.d/uploads.ini
|
||||
|
||||
# Install system dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
@ -15,26 +16,21 @@ RUN apt-get update && apt-get install -y \
|
||||
unzip \
|
||||
libzip-dev \
|
||||
libmagickwand-dev \
|
||||
mariadb-client
|
||||
|
||||
# Clear cache
|
||||
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
mariadb-client \
|
||||
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN pecl install imagick \
|
||||
&& docker-php-ext-enable imagick
|
||||
|
||||
# Install PHP extensions
|
||||
RUN docker-php-ext-install pdo_mysql mbstring zip exif pcntl bcmath gd
|
||||
RUN rmdir html && docker-php-ext-install pdo_mysql mbstring zip exif pcntl bcmath gd
|
||||
|
||||
# Get latest Composer
|
||||
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
||||
|
||||
# Create system user to run Composer and Artisan Commands
|
||||
RUN useradd -G www-data,root -u $uid -d /home/$user $user
|
||||
RUN mkdir -p /home/$user/.composer && \
|
||||
chown -R $user:$user /home/$user
|
||||
RUN useradd -G www-data,root -u 1000 -d /home/crater crater && chmod 777 /var/www/ && chown 1000:1000 /var/www/
|
||||
USER 0
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /var/www
|
||||
|
||||
USER $user
|
||||
COPY ./docker-compose/startup.sh /startup.sh
|
||||
|
||||
CMD ["/startup.sh"]
|
||||
|
||||
Reference in New Issue
Block a user