-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdockerfile
More file actions
65 lines (48 loc) · 2.13 KB
/
dockerfile
File metadata and controls
65 lines (48 loc) · 2.13 KB
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
64
65
FROM php:8.3-apache AS web
# Εγκατάσταση των GPG keys και άλλων απαιτούμενων πακέτων
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
apt-transport-https \
gnupg \
debian-archive-keyring \
libzip-dev \
zip \
unzip \
curl \
git \
nano && apt-get clean && rm -rf /var/lib/apt/lists/*
# Ενεργοποίηση Apache mod_rewrite
RUN a2enmod rewrite
# Εγκατάσταση PHP extensions
RUN docker-php-ext-install pdo_mysql zip
# Εγκατάσταση Node.js και npm
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
apt-get install -y nodejs
# Ρύθμιση DocumentRoot του Apache για Laravel
ENV APACHE_DOCUMENT_ROOT=/var/www/html/public
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
# Αντιγραφή του project
COPY . /var/www/html
# Ορισμός Working Directory
WORKDIR /var/www/html
# Εγκατάσταση Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# Ορισμός περιβάλλοντος για τον Composer
ENV COMPOSER_ALLOW_SUPERUSER=1
# Εγκατάσταση των npm εξαρτήσεων
RUN npm install && npm run build
RUN composer install --no-dev --optimize-autoloader
# Αντιγραφή .env και δημιουργία κλειδιού Laravel
RUN cp .env.example .env
RUN php artisan key:generate
RUN mkdir -p /var/www/html/storage/logs && touch /var/www/html/storage/logs/laravel.log
# Ορισμός σωστών δικαιωμάτων σε storage & bootstrap/cache
RUN chown -R www-data:www-data /var/www/html/storage /var/www/html/bootstrap/cache
# Αντιγραφή του entrypoint script
COPY docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
# Ορισμός του entrypoint script
ENTRYPOINT ["docker-entrypoint.sh"]
# Εκκίνηση του Apache
CMD ["apache2-foreground"]