Skip to content

Commit 1c6fa59

Browse files
committed
refactor: refactoring Dockerfile.dev per installare i pacchetti di sistema richiesti e le estensioni PHP
1 parent e7135e3 commit 1c6fa59

1 file changed

Lines changed: 51 additions & 43 deletions

File tree

docker/Dockerfile.dev

Lines changed: 51 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,72 @@
1-
# Usa l'immagine ufficiale di PHP con Apache
21
FROM php:8.3-apache-bullseye
32

4-
# Abilita i moduli richiesti
5-
RUN apt-get update && apt-get install -y \
3+
# Installa dipendenze di sistema ed estensioni PHP
4+
RUN apt-get update && apt-get install -y --no-install-recommends \
65
libzip-dev \
76
libicu-dev \
87
libcurl4-openssl-dev \
98
libxml2-dev \
109
libpng-dev \
10+
libjpeg-dev \
1111
libonig-dev \
12+
libxslt-dev \
1213
unzip \
13-
libxml2-dev \
14-
libxslt-dev \
15-
wget \
14+
wget \
1615
git && \
17-
docker-php-ext-install zip mbstring pdo_mysql intl soap curl && \
18-
a2enmod rewrite
16+
docker-php-ext-configure gd --with-jpeg && \
17+
docker-php-ext-install \
18+
zip \
19+
mbstring \
20+
pdo_mysql \
21+
intl \
22+
soap \
23+
curl \
24+
xsl \
25+
ftp \
26+
gd && \
27+
a2enmod rewrite && \
28+
curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
29+
apt-get install -y nodejs && \
30+
apt-get clean && \
31+
rm -rf /var/lib/apt/lists/* /tmp/*
1932

20-
RUN docker-php-ext-install xsl ftp
21-
22-
RUN docker-php-ext-enable xsl ftp
23-
24-
RUN apt-get install -y libpng-dev libjpeg-dev \
25-
&& docker-php-ext-configure gd --with-jpeg \
26-
&& docker-php-ext-install gd
27-
28-
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
29-
&& apt-get install -y nodejs
30-
31-
32-
# Configura i parametri di PHP
33+
# Copia configurazione PHP
3334
COPY php.ini /usr/local/etc/php/
3435

35-
# Installa Composer
36+
# Installa Composer dall'immagine ufficiale
3637
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
3738

38-
# Configura l'applicazione
39+
# Imposta directory di lavoro
3940
WORKDIR /var/www/html
40-
# Esponi la porta per Apache
41-
EXPOSE 80
4241

43-
# Clona il repository
44-
RUN git clone https://github.com/devcode-it/openstamanager.git /var/www/html
42+
# Clona repository e inizializza directory
43+
RUN git clone https://github.com/devcode-it/openstamanager.git . && \
44+
git config --global --add safe.directory /var/www/html && \
45+
mkdir -p files/temp logs
46+
47+
# Crea file di configurazione
48+
RUN touch manifest.json \
49+
mariadb_10_x.json \
50+
mysql_8_3.json \
51+
mysql.json \
52+
checksum.json \
53+
settings.json \
54+
views.json \
55+
modules.json
4556

46-
RUN mkdir -p /var/www/html/files/temp /var/www/html/logs
47-
RUN chown -R $USER:www-data /var/www/html/
48-
RUN chmod -R 770 /var/www/html/
49-
RUN touch /var/www/html/manifest.json \
50-
/var/www/html/mariadb_10_x.json \
51-
/var/www/html/mysql_8_3.json \
52-
/var/www/html/mysql.json \
53-
/var/www/html/checksum.json \
54-
/var/www/html/settings.json \
55-
/var/www/html/views.json
56-
/var/www/html/modules.json
57+
# Installa dipendenze PHP con Composer
58+
RUN curl -sS https://getcomposer.org/installer | php && \
59+
php composer.phar install
5760

58-
RUN curl -sS https://getcomposer.org/installer | php
59-
RUN git config --global --add safe.directory /var/www/html
60-
RUN corepack enable
61-
RUN corepack prepare yarn@stable --activate
61+
# Installa dipendenze Node.js e compila asset
62+
RUN corepack enable && \
63+
corepack prepare yarn@stable --activate && \
64+
yarn run develop-OSM
6265

63-
RUN yarn run develop-OSM
66+
# Imposta permessi corretti per i file dell'applicazione
67+
RUN chown -R www-data:www-data /var/www/html && \
68+
chmod -R 755 /var/www/html && \
69+
chmod -R 775 /var/www/html/files /var/www/html/logs /var/www/html/storage
6470

71+
# Espone porta Apache
72+
EXPOSE 80

0 commit comments

Comments
 (0)