Skip to content

Commit

Permalink
Removed Apache as development web server in favour of Symfony CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianLeChat committed Mar 29, 2024
1 parent d91a884 commit 3e0250b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ services:
memory: 128M
build:
context: .
dockerfile: ./docker/Dockerfile-${APP_ENV}
dockerfile: ./docker/Dockerfile.${APP_ENV}
ports:
- "80:80"
- "8000:8000"
- "8443:8443/udp"
22 changes: 10 additions & 12 deletions docker/Dockerfile-dev → docker/Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

# Use an customized image of PHP
# https://hub.docker.com/_/php
FROM php:apache
FROM php:alpine

# Install dependencies
RUN apt update && apt install cron -y
RUN apk update && apk add --no-cache bash

# Install some PHP extensions
RUN curl -sSLf -o /usr/local/bin/install-php-extensions \
Expand Down Expand Up @@ -36,21 +36,19 @@ RUN echo "0 * * * * /usr/local/bin/php /var/www/html/bin/console app:statistics-
# Copy the remaining files AFTER installing dependencies
COPY --chown=www-data:www-data . .

# Set the document root to the public folder
ENV APACHE_DOCUMENT_ROOT /var/www/html/public
RUN sed -ri -e "s!/var/www/html!${APACHE_DOCUMENT_ROOT}!g" /etc/apache2/sites-available/*.conf && \
sed -ri -e "s!/var/www/!${APACHE_DOCUMENT_ROOT}!g" /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf && \
a2enmod rewrite

# Add wait script to wait for other services to be ready
ADD https://github.com/ufoscout/docker-compose-wait/releases/latest/download/wait /wait
RUN chmod +x /wait

# Install Symfony CLI
RUN curl -1sLf https://dl.cloudsmith.io/public/symfony/stable/setup.alpine.sh | bash && \
apk add symfony-cli

# Use the default or custom PHP configuration (if exists)
RUN mv $PHP_INI_DIR/php.ini-production $PHP_INI_DIR/php.ini && \
if [ -f "docker/php.ini" ]; then \
mv "docker/php.ini" "$PHP_INI_DIR/php.ini"; \
fi
if [ -f "docker/php.ini" ]; then \
mv "docker/php.ini" "$PHP_INI_DIR/php.ini"; \
fi

# Change current user to www-data
USER www-data
Expand All @@ -61,6 +59,6 @@ RUN mkdir -p docker && echo '/wait && mkdir -p var/cache var/log && \
/usr/local/bin/php bin/console doctrine:database:create --no-interaction --if-not-exists && \
/usr/local/bin/php bin/console doctrine:schema:update --complete --force && \
/usr/local/bin/php bin/console app:udp-server 127.0.0.1:8443 & \
apache2-foreground' > docker/entrypoint.sh && chmod +x docker/entrypoint.sh
symfony server:start' > docker/entrypoint.sh && chmod +x docker/entrypoint.sh

CMD ["docker/entrypoint.sh"]
File renamed without changes.

0 comments on commit 3e0250b

Please sign in to comment.