-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
63 lines (47 loc) · 1.84 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
53
54
55
56
57
58
59
60
61
62
63
# Use an official PHP image with Apache
FROM php:7.4-apache
# Install necessary PHP extensions, Composer, and Java (required for Liquibase)
RUN apt-get update && apt-get install -y \
libzip-dev \
unzip \
default-jre \
wget \
&& docker-php-ext-install mysqli pdo pdo_mysql zip \
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# Install Liquibase
RUN mkdir /liquibase && \
wget -O /liquibase/liquibase.tar.gz https://github.com/liquibase/liquibase/releases/download/v4.28.0/liquibase-4.28.0.tar.gz && \
tar -xzf /liquibase/liquibase.tar.gz -C /liquibase && \
rm /liquibase/liquibase.tar.gz && \
chmod +x /liquibase/liquibase
# Add Liquibase to PATH
ENV PATH="/liquibase:${PATH}"
# Download MySQL JDBC driver dynamically
RUN wget -O /liquibase/lib/mysql-connector-java.jar https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.30/mysql-connector-java-8.0.30.jar
# Set working directory
WORKDIR /var/www/html
# List files in the current directory (for debug purposes)
RUN echo "Files in the current directory before copying:" && ls -la
# Copy the application code to the container
COPY . .
# Install PHP dependencies
RUN composer install
# Set permissions (optional but recommended)
RUN chown -R www-data:www-data /var/www/html && \
chmod -R 755 /var/www/html
# Enable Apache mod_rewrite and SSL
RUN a2enmod rewrite
RUN a2enmod ssl
# Copy custom php.ini
COPY php.ini /usr/local/etc/php/conf.d/
# Copy Liquibase changelog files
COPY ./liquibase /var/www/html/liquibase
# Copy SSL configuration file
COPY ssl.conf /etc/apache2/sites-available/ssl.conf
# Enable the SSL virtual host
RUN a2ensite ssl.conf
# Create a script to run Liquibase and start Apache
COPY start.sh /start.sh
RUN chmod +x /start.sh
# Use the start script as the entry point
CMD ["/start.sh"]