Skip to content

Commit 1a6c71a

Browse files
Merge pull request #11 from devcordde/fix/docker-setup
Install dependencies during Docker build, cleanup Dockerfile
2 parents 1ed227c + 9f9799a commit 1a6c71a

6 files changed

Lines changed: 70 additions & 41 deletions

File tree

.dockerignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
.git/
33
.github/
44
.env*
5+
vendor/
56
Dockerfile*
67
info.php
7-
compose*
8+
compose.*
89
README.md
910
.dockerignore
1011
.gitattributes
1112
.gitignore
13+
debug.sh

Dockerfile

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,43 @@
11
FROM php:8-apache
22

3+
# Install system dependencies
34
RUN apt-get update && \
45
apt-get install -y \
5-
zlib1g-dev
6-
7-
RUN apt-get install -y \
8-
libxml2-dev
9-
6+
zlib1g-dev \
7+
libxml2-dev \
8+
libssl-dev \
9+
libfreetype-dev \
10+
libjpeg62-turbo-dev \
11+
libpng-dev \
12+
unzip \
13+
git
14+
15+
# Install PHP extensions
1016
RUN /usr/local/bin/docker-php-ext-install mysqli pdo pdo_mysql
11-
RUN apt-get install libssl-dev -y
12-
13-
ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS="0"
1417

1518
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
16-
1719
RUN chmod +x /usr/local/bin/install-php-extensions && \
1820
install-php-extensions gd
1921

20-
RUN apt-get update && apt-get install -y \
21-
libfreetype-dev \
22-
libjpeg62-turbo-dev \
23-
libpng-dev \
24-
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
25-
&& docker-php-ext-install -j$(nproc) gd
22+
# Install Composer
23+
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
2624

25+
# Apache configuration
2726
COPY docker/000-default.conf /etc/apache2/sites-available/000-default.conf
2827
RUN a2enmod rewrite
2928

29+
# Application setup
3030
COPY . /var/www/
31+
WORKDIR /var/www
32+
33+
# Install dependencies, then delete Composer files
34+
RUN composer install --no-interaction --no-dev --optimize-autoloader
35+
RUN rm composer.*
36+
3137
RUN chown -R www-data:www-data /var/www
3238

3339
COPY docker/start-apache /usr/local/bin
3440

3541
ENV APP_PATH=/var/www
3642

37-
CMD ["start-apache"]
43+
CMD ["start-apache"]

Dockerfile.debug

Lines changed: 0 additions & 22 deletions
This file was deleted.

compose.debug.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ services:
1010
container_name: bivieh_devmarkt_dev
1111
build:
1212
context: .
13-
dockerfile: Dockerfile.debug
13+
dockerfile: debug.Dockerfile
1414
ports:
1515
- "8080:80"
1616
volumes:

debug.Dockerfile

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
FROM php:8-apache
2+
3+
# Install system dependencies
4+
RUN apt-get update && \
5+
apt-get install -y \
6+
zlib1g-dev \
7+
libxml2-dev \
8+
libssl-dev \
9+
libfreetype-dev \
10+
libjpeg62-turbo-dev \
11+
libpng-dev \
12+
unzip \
13+
git
14+
15+
# Install PHP extensions
16+
RUN /usr/local/bin/docker-php-ext-install mysqli pdo pdo_mysql
17+
18+
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
19+
RUN chmod +x /usr/local/bin/install-php-extensions && \
20+
install-php-extensions gd
21+
22+
# Install Composer
23+
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
24+
25+
# Apache configuration
26+
COPY docker/000-default.conf /etc/apache2/sites-available/000-default.conf
27+
RUN a2enmod rewrite
28+
29+
# Application setup
30+
COPY . /var/www/
31+
WORKDIR /var/www
32+
33+
# Install dependencies (including dev for debug mode), then delete Composer files
34+
RUN composer install --no-interaction
35+
RUN rm composer.*
36+
37+
RUN chown -R www-data:www-data /var/www
38+
39+
COPY docker/start-apache /usr/local/bin
40+
41+
ENV APP_PATH=/var/www
42+
43+
CMD ["start-apache"]

debug.sh

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
docker-compose -f compose.debug.yaml up
1+
docker-compose -f compose.debug.yaml up --build

0 commit comments

Comments
 (0)