File size: 1,516 Bytes
7427fd3
3a69aae
b859a6d
6b5b1be
 
 
 
 
 
 
 
 
b859a6d
0e0137f
 
b859a6d
0e0137f
 
b859a6d
6b5b1be
 
b859a6d
 
 
954924b
8b2b629
0a9e19d
b859a6d
6b5b1be
 
b859a6d
0e0137f
 
 
b859a6d
6b5b1be
 
 
 
 
df6891d
0e0137f
 
 
df6891d
 
 
d92a0c1
0e0137f
6b5b1be
 
b859a6d
9382a64
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
FROM php:8.2-fpm

# Install system dependencies
RUN apt-get update && apt-get install -y \
    libonig-dev \
    libpng-dev \
    libxml2-dev \
    zip \
    unzip \
    git \
    curl

# Install PHP extensions
RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd

# Download and install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

# Set working directory to /app
WORKDIR /app

# Check if we are in a local or online environment
ARG APP_ENV

RUN --mount=type=secret,id=GITHUB_PAT \    
    git clone --branch next https://lucianotonet:$(cat /run/secrets/GITHUB_PAT)@github.com/agenciamav/app.agenciamav.com.br.git .

# If local, just copy the files
COPY . /app

# Install PHP dependencies
RUN --mount=type=secret,id=OPENAI_API_KEY \
    composer install

# Run initial Laravel commands
RUN php artisan storage:link && \
    php artisan config:cache && \
    php artisan route:cache && \
    php artisan view:cache

# Change the owner and permissions of the log directory
RUN chown -R www-data:www-data /app/storage && \
    chmod -R 775 /app/storage && \
    chown -R www-data:www-data /app/bootstrap/cache && \
    chmod -R 775 /app/bootstrap/cache && \
    touch /app/storage/logs/laravel.log && \
    chown www-data:www-data /app/storage/logs/laravel.log && \
    chmod -R 775 /app/storage/logs/laravel.log

EXPOSE 7860

# Run the script when the container starts
CMD ["sh", "-c", "php artisan serve --host=0.0.0.0 --port=7860"]