3
3
# https://hub.docker.com/_/debian
4
4
FROM debian:bookworm-slim
5
5
6
+
6
7
# Configure apt not to prompt during docker build
7
8
ARG DEBIAN_FRONTEND=noninteractive
8
9
@@ -12,7 +13,7 @@ RUN apt-config dump \
12
13
| sed -e's/1/0/' \
13
14
| tee /etc/apt/apt.conf.d/99no-recommends-no-suggests
14
15
15
- # Resynchronize the package
16
+ # Resynchronize the package index files from their sources
16
17
RUN apt-get update
17
18
18
19
# Install packages
@@ -44,21 +45,30 @@ RUN rm -rf /var/lib/apt/lists/*
44
45
RUN adduser www-data sudo
45
46
COPY config/www-data_startupservice /etc/sudoers.d/www-data_startupservice
46
47
48
+ # Initialize and start Apache service
49
+ COPY config/startupservice.sh /startupservice.sh
50
+ RUN chmod +x /startupservice.sh
51
+ CMD ["sudo" , "/startupservice.sh" ]
52
+
53
+
54
+ # Expose ports for Apache
55
+ EXPOSE 80
56
+
47
57
48
58
# Enable Apache modules
49
59
RUN a2enmod php8.2
50
60
RUN a2enmod rewrite
51
61
52
62
53
- # create an index directory
63
+ # create an index directory and set permissions
54
64
RUN mkdir -p /var/www/index
65
+ RUN chown -R www-data:www-data /var/www/index
66
+
55
67
56
68
# Install Composer
57
69
RUN curl -sS https://getcomposer.org/installer \
58
70
| php -- --install-dir=/usr/local/bin --filename=composer
59
71
60
- # set permissions
61
- RUN chown -R www-data:www-data /var/www/index
62
72
63
73
# Install WordPress CLI
64
74
RUN curl -L \
@@ -67,21 +77,8 @@ RUN curl -L \
67
77
&& chmod +x wp-cli.phar \
68
78
&& mv wp-cli.phar /usr/local/bin/wp
69
79
80
+
70
81
# Set up WordPress
71
82
USER www-data
72
83
WORKDIR /var/www/index
73
84
RUN wp core download
74
-
75
- # Switch to root
76
- USER root
77
-
78
- # Initialize and start Apache service
79
- COPY config/startupservice.sh /startupservice.sh
80
- RUN chmod +x /startupservice.sh
81
-
82
- # Expose ports for Apache and MariaDB
83
- EXPOSE 80
84
-
85
- CMD ["sudo" , "/startupservice.sh" ]
86
-
87
- USER www-data
0 commit comments