random-web-tools/Dockerfile
stuzer05 48f5fa4ce1
Some checks failed
build docker image / docker-build (push) Failing after 49s
Add docker deployment
2024-11-05 11:18:58 +02:00

83 lines
2.0 KiB
Docker

# Build stage
FROM node:18-alpine AS node-builder
WORKDIR /app
COPY . .
RUN npm install -g vite \
&& npm install \
&& npm run build
# PHP stage
FROM php:8.3-fpm-alpine
# Install system packages
RUN apk add --no-cache \
nginx \
supervisor \
curl \
nano \
gettext
icu-libs \
libzip
# Install PHP modules
RUN apk add --no-cache --virtual .build-deps \
icu-dev \
libzip-dev \
freetype-dev \
libpng-dev \
libjpeg-turbo-dev \
libwebp-dev \
bzip2-dev \
curl-dev \
tidyhtml-dev \
libxslt-dev \
oniguruma-dev \
sqlite-dev \
libzip \
bzip2 \
libxslt \
oniguruma \
sqlite-libs \
&& docker-php-ext-install -j$(nproc) \
mbstring \
xml \
dom \
zip \
intl \
curl \
calendar \
pdo_sqlite \
bcmath \
&& apk del .build-deps
# Configure php-fpm
RUN sed -i 's/listen = 127.0.0.1:9000/listen = \/run\/php\/php-fpm.sock/' /usr/local/etc/php-fpm.d/www.conf \
&& sed -i 's/;listen.owner = www-data/listen.owner = www-data/' /usr/local/etc/php-fpm.d/www.conf \
&& sed -i 's/;listen.group = www-data/listen.group = www-data/' /usr/local/etc/php-fpm.d/www.conf \
&& sed -i 's/;listen.mode = 0660/listen.mode = 0660/' /usr/local/etc/php-fpm.d/www.conf \
&& cp /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini \
&& sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 200M/' /usr/local/etc/php/php.ini \
&& sed -i 's/post_max_size = 8M/post_max_size = 200M/' /usr/local/etc/php/php.ini
# Copy configurations
COPY ./docker/conf/etc /etc
# Copy built application from node stage
COPY --from=node-builder /app/dist /var/www/html
COPY --from=node-builder /app/api /var/www/html/api
# Set permissions
RUN chown -R www-data:www-data /var/www/html
# Create system dirs
RUN mkdir -p /var/run && \
mkdir -p /run/php
# Copy and set entrypoint
COPY ./entrypoint.sh /
CMD ["/bin/sh", "/entrypoint.sh"]
EXPOSE 80