Spaces:
Sleeping
Sleeping
Commit
·
b859a6d
1
Parent(s):
3a69aae
Udpate
Browse files- Dockerfile +22 -4
Dockerfile
CHANGED
@@ -1,8 +1,7 @@
|
|
|
|
1 |
FROM php:8.2-fpm
|
2 |
|
3 |
-
|
4 |
-
RUN echo "Cache bust: $CACHEBUST" > /dev/null
|
5 |
-
|
6 |
RUN apt-get update && apt-get install -y \
|
7 |
libonig-dev \
|
8 |
libpng-dev \
|
@@ -12,26 +11,42 @@ RUN apt-get update && apt-get install -y \
|
|
12 |
git \
|
13 |
curl
|
14 |
|
|
|
15 |
RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd
|
16 |
|
|
|
17 |
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
18 |
|
|
|
19 |
WORKDIR /app
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
RUN --mount=type=secret,id=GITHUB_PAT \
|
|
|
22 |
rm -rf /app/* /app/.* || true && \
|
23 |
-
git clone https://lucianotonet:$(cat /run/secrets/GITHUB_PAT)@github.com/agenciamav/app.agenciamav.com.br.git .
|
|
|
24 |
|
|
|
25 |
COPY . /app
|
26 |
|
|
|
27 |
RUN --mount=type=secret,id=OPENAI_API_KEY \
|
28 |
composer install
|
29 |
|
|
|
30 |
RUN php artisan storage:link && \
|
31 |
php artisan config:cache && \
|
32 |
php artisan route:cache && \
|
33 |
php artisan view:cache
|
34 |
|
|
|
35 |
RUN chown -R www-data:www-data /app/storage && \
|
36 |
chmod -R 775 /app/storage && \
|
37 |
chown -R www-data:www-data /app/bootstrap/cache && \
|
@@ -39,8 +54,11 @@ RUN chown -R www-data:www-data /app/storage && \
|
|
39 |
|
40 |
EXPOSE 7860
|
41 |
|
|
|
42 |
COPY start.sh /start.sh
|
43 |
|
|
|
44 |
RUN chmod +x /start.sh
|
45 |
|
|
|
46 |
CMD ["/start.sh"]
|
|
|
1 |
+
# syntax=docker/dockerfile:1.2
|
2 |
FROM php:8.2-fpm
|
3 |
|
4 |
+
# Install system dependencies
|
|
|
|
|
5 |
RUN apt-get update && apt-get install -y \
|
6 |
libonig-dev \
|
7 |
libpng-dev \
|
|
|
11 |
git \
|
12 |
curl
|
13 |
|
14 |
+
# Install PHP extensions
|
15 |
RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd
|
16 |
|
17 |
+
# Download and install Composer
|
18 |
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
19 |
|
20 |
+
# Set working directory to /app
|
21 |
WORKDIR /app
|
22 |
|
23 |
+
ARG CACHEBUST=1
|
24 |
+
RUN echo "Cache bust: $CACHEBUST" > /dev/null
|
25 |
+
|
26 |
+
# Check if we are in a local or online environment
|
27 |
+
ARG APP_ENV
|
28 |
+
|
29 |
+
# If online, clone the private repository without using cache
|
30 |
RUN --mount=type=secret,id=GITHUB_PAT \
|
31 |
+
if [ "$APP_ENV" != "local" ] ; then \
|
32 |
rm -rf /app/* /app/.* || true && \
|
33 |
+
git clone https://lucianotonet:$(cat /run/secrets/GITHUB_PAT)@github.com/agenciamav/app.agenciamav.com.br.git . ; \
|
34 |
+
fi
|
35 |
|
36 |
+
# If local, just copy the files
|
37 |
COPY . /app
|
38 |
|
39 |
+
# Install PHP dependencies
|
40 |
RUN --mount=type=secret,id=OPENAI_API_KEY \
|
41 |
composer install
|
42 |
|
43 |
+
# Run initial Laravel commands
|
44 |
RUN php artisan storage:link && \
|
45 |
php artisan config:cache && \
|
46 |
php artisan route:cache && \
|
47 |
php artisan view:cache
|
48 |
|
49 |
+
# Alterar o proprietário e as permissões do diretório de logs
|
50 |
RUN chown -R www-data:www-data /app/storage && \
|
51 |
chmod -R 775 /app/storage && \
|
52 |
chown -R www-data:www-data /app/bootstrap/cache && \
|
|
|
54 |
|
55 |
EXPOSE 7860
|
56 |
|
57 |
+
# Copy the script into the container
|
58 |
COPY start.sh /start.sh
|
59 |
|
60 |
+
# Make the script executable
|
61 |
RUN chmod +x /start.sh
|
62 |
|
63 |
+
# Run the script when the container starts
|
64 |
CMD ["/start.sh"]
|