Skip to content

Commit

Permalink
build: use other commands to start server
Browse files Browse the repository at this point in the history
  • Loading branch information
KennethTrecy committed Jun 15, 2024
1 parent 1db0258 commit cf45a82
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# - `initial_influence`. https://dev.to/veevidify/docker-compose-up-your-entire-laravel-apache-mysql-development-environment-45ea
# - `libonig-dev`. https://www.limstash.com/en/articles/202002/1539

FROM php:8.2-apache AS base
FROM php:8.2-cli AS base

# 1. Install necessary packages.
RUN apt-get update && apt-get install -y \
Expand All @@ -21,11 +21,11 @@ RUN apt-get update && apt-get install -y \
# 2. Apache configs + document root.
# RUN echo "ServerName server.peratorakka.local" >> /etc/apache2/apache2.conf

RUN sed -ri -e 's!/var/www/html!/var/www/html/public!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!/var/www/!/var/www/html/public!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
# RUN sed -ri -e 's!/var/www/html!/var/www/html/public!g' /etc/apache2/sites-available/*.conf
# RUN sed -ri -e 's!/var/www/!/var/www/html/public!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf

# 3. mod_rewrite for URL rewrite and mod_headers for .htaccess extra headers like Access-Control-Allow-Origin-
RUN a2enmod rewrite headers
# RUN a2enmod rewrite headers

# 4. Copy base PHP config from development.
RUN cp "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"
Expand Down Expand Up @@ -131,7 +131,6 @@ RUN rm -rf /var/lib/apt/lists/*
# 7. Install composer.
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer


##########


Expand Down Expand Up @@ -160,5 +159,8 @@ RUN sudo chmod -R a+rw /var/www/html/vendor
# 5. Migrate all tables
RUN /usr/bin/composer run seed:initial

# 6. Restart HTTP service to apply changes
RUN service apache2 restart
# 6. Start HTTP service to apply changes
# RUN service apache2 restart
CMD [ "php", "spark", "serve", "--host=0.0.0.0", "--port=80" ]

EXPOSE 80

0 comments on commit cf45a82

Please sign in to comment.