-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
87 lines (72 loc) · 2.37 KB
/
Dockerfile
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
FROM php:8.2.1-apache
RUN apt-get update
RUN apt-get install libonig-dev
RUN apt-get install -y libzip-dev
# 1. development packages
RUN apt-get install -y \
git \
zip \
curl \
sudo \
unzip \
libicu-dev \
libbz2-dev \
libpng-dev \
libjpeg-dev \
libmcrypt-dev \
libreadline-dev \
libfreetype6-dev \
g++
# RUN curl -sL https://deb.nodesource.com/setup | bash
RUN apt-get install -yq nodejs npm
RUN npm install -g n
RUN n stable
# # add user with sudo privileges within Docker container
# # without adduser input questions
# # http://askubuntu.com/questions/94060/run-adduser-non-interactively/94067#94067
# RUN USER="testuser"
# RUN adduser --disabled-password --gecos "" $USER
# RUN sudo usermod -a -G sudo $USER
# RUN echo "$USER:abc123" | chpasswd
# RUN su - $USER # switch to testuser
# 2. apache configs + document root
ENV APACHE_DOCUMENT_ROOT=/var/www/html/public
ENV APACHE_RUN_USER=#1000
ENV APACHE_RUN_GROUP=#1000
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
# 3. mod_rewrite for URL rewrite and mod_headers for .htaccess extra headers like Access-Control-Allow-Origin-
RUN a2enmod rewrite headers
# 4. start with base php config, then add extensions
RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"
RUN docker-php-ext-install \
bz2 \
intl \
iconv \
bcmath \
opcache \
calendar \
mbstring \
pdo_mysql \
zip
# 5. composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# 6. we need a user with the same UID/GID with host user
# so when we execute CLI commands, all the host file's ownership remains intact
# otherwise command from inside container will create root-owned files and directories
ARG uid
RUN useradd -G www-data,root -u 1000 -d /home/devuser devuser
RUN mkdir -p /home/devuser/.composer && \
chown -R devuser:devuser /home/devuser
# RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
# This loads nvm
# RUN nvm use v14.18.0
# This loads nvm bash_completion
WORKDIR /var/www/html
COPY . /var/www/html/
RUN npm install
ENV COMPOSER_ALLOW_SUPERUSER=1
RUN composer install
RUN composer require laravel/ui --dev
RUN php artisan key:generate
RUN php artisan ui vue --auth