-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.local
61 lines (46 loc) · 2.17 KB
/
Dockerfile.local
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
# Used for DEV & Local.
FROM php:8.2-fpm as php
ARG NODE_VERSION=20
# Install dependencies.
RUN apt-get update && apt-get install -y unzip libpq-dev libcurl4-gnutls-dev nginx libonig-dev
RUN apt-get update && apt-get install -y gnupg gosu curl ca-certificates \
&& mkdir -p /etc/apt/keyrings
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_VERSION.x nodistro main" > /etc/apt/sources.list.d/nodesource.list \
&& apt-get update \
&& apt-get install -y nodejs
# Install PHP extensions.
RUN docker-php-ext-install mysqli pdo pdo_mysql bcmath curl mbstring
# Copy composer executable.
COPY --from=composer:2.3.5 /usr/bin/composer /usr/bin/composer
# Copy configuration files.
COPY ./docker/php/php.ini /usr/local/etc/php/php.ini
COPY ./docker/php/php-fpm.conf /usr/local/etc/php-fpm.d/www.conf
COPY ./docker/nginx/nginx.conf /etc/nginx/nginx.conf
# Install Xdebug
RUN pecl install xdebug && docker-php-ext-enable xdebug
# Set working directory to /var/www.
WORKDIR /var/www
# Copy files from current folder to container current folder (set in workdir).
COPY --chown=www-data:www-data . .
# Create laravel caching folders.
RUN mkdir -p /var/www/storage/framework /var/www/storage/framework/cache \
/var/www/storage/framework/testing /var/www/storage/framework/sessions \
/var/www/storage/framework/views
RUN mkdir -p /var/www/storage /var/www/storage/logs /var/www/storage/framework \
/var/www/storage/framework/sessions /var/www/bootstrap
# Fix files ownership.
RUN chown -R www-data /var/www/storage
RUN chown -R www-data /var/www/storage/framework
RUN chown -R www-data /var/www/storage/framework/sessions
# Set correct permission.
RUN chmod -R 755 /var/www/storage
RUN chmod -R 755 /var/www/storage/logs
RUN chmod -R 755 /var/www/storage/framework
RUN chmod -R 755 /var/www/storage/framework/sessions
RUN chmod -R 755 /var/www/bootstrap
# Adjust user permission & group
RUN usermod --uid 1000 www-data
RUN groupmod --gid 1001 www-data
# Run the entrypoint file.
ENTRYPOINT [ "docker/entrypoint.local.sh" ]