-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
52 lines (40 loc) · 1.57 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# This is a multi stage build
# Base image (contains server and http)
FROM php:8.3-apache AS base
ENV BASE_PATH=/
ENV APP_PATH=/
# Install php extensions
ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
RUN install-php-extensions zip pgsql mysqli pdo pdo_mysql pdo_pgsql pdo_odbc sqlite3 ldap zip curl ffi fileinfo ftp gettext imap mbstring intl sockets
WORKDIR /var/www/html/
COPY . .
COPY ./docker_config_files/php.ini /usr/local/etc/php/
# Use composer to build the dependencies
FROM composer:latest AS composer
WORKDIR /var/www/html/
COPY --from=base /var/www/html/composer.json .
RUN composer update --no-interaction --no-progress
# Move the downloaded dependencies to the actual place they need to be
FROM base AS final
WORKDIR /var/www/html/
COPY --from=composer /var/www/html/vendor/ ./vendor/
COPY --from=composer /var/www/html/var/ ./var/
COPY ./docker_config_files/template.htaccess ./.htaccess
# Enable mod_rewrite.c
RUN a2enmod rewrite
RUN chmod +x bin/console
RUN chmod -R 777 ./var/cache/
# Download packages
RUN php bin/console importmap:install
RUN php bin/console asset-map:compile
# SSH setup for container
COPY ./docker_config_files/startup.sh ./startup.sh
RUN apt-get update \
&& apt-get install -y --no-install-recommends dialog \
&& apt-get install -y --no-install-recommends openssh-server \
&& echo "root:Docker!" | chpasswd \
&& chmod u+x ./startup.sh
COPY ./docker_config_files/sshd_config /etc/ssh/
# Start the server
EXPOSE 80 2222
ENTRYPOINT [ "./startup.sh" ]