forked from ihsanberahim/cloudrun-for-laravel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcloudrun.Dockerfile
85 lines (68 loc) · 2.31 KB
/
cloudrun.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
FROM php:8.2-apache
# Install dependencies
RUN apt-get update && apt-get install -y \
# telnet \
# screen \
apt-transport-https \
ca-certificates \
build-essential \
python \
supervisor \
libzip-dev \
libpng-dev \
libjpeg62-turbo-dev \
libfreetype6-dev \
locales \
zip \
jpegoptim optipng pngquant gifsicle \
vim \
unzip \
git \
curl \
wget
# Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# Install Npm
ENV NVM_DIR /usr/local/nvm
# check recommended node version from vite docs site
# https://vitejs.dev/guide/#scaffolding-your-first-vite-project
ENV NODE_VERSION 16.19.1
# Install nvm with node and npm
SHELL ["/bin/bash", "--login", "-c"]
RUN mkdir -p $NVM_DIR
RUN curl https://raw.githubusercontent.com/creationix/nvm/v0.39.3/install.sh | bash \
&& source $NVM_DIR/nvm.sh \
&& nvm install $NODE_VERSION \
&& nvm alias default $NODE_VERSION \
&& nvm use default
ENV NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules
ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
# Install extensions
RUN docker-php-ext-install pdo_mysql zip exif pcntl opcache
RUN docker-php-ext-configure gd --with-freetype --with-jpeg
RUN docker-php-ext-install gd
# Install Redis
RUN pecl install -o -f redis \
&& rm -rf /tmp/pear \
&& docker-php-ext-enable redis
#For Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
WORKDIR /var/www/html
COPY . ./
RUN composer install
RUN npm i
RUN mkdir -p /var/www/html/public/build
RUN chmod -R 777 /var/www/html/public/build
RUN npm run build
RUN php artisan telescope:install
RUN chown -R www-data: /var/www/html
# Use the PORT environment variable in Apache configuration files.
# https://cloud.google.com/run/docs/reference/container-contract#port
COPY cloudrun/000-default.conf /etc/apache2/sites-available/000-default.conf
RUN sed -i 's/80/${PORT}/g' /etc/apache2/sites-available/000-default.conf /etc/apache2/ports.conf
RUN a2enmod rewrite
# Configure PHP for development.
# Switch to the production php.ini for production operations.
# RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
# https://github.com/docker-library/docs/blob/master/php/README.md#configuration
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"