-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
86 lines (59 loc) · 3.06 KB
/
Dockerfile
File metadata and controls
86 lines (59 loc) · 3.06 KB
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
################################################################################
# Install Composer Dependencies
################################################################################
FROM composer as composer
COPY . /app
WORKDIR /app
RUN composer install
################################################################################
# Install Node Dependencies
################################################################################
FROM node:16.15.1 as node
COPY --from=composer /app /app
WORKDIR /app
RUN npm install
RUN npm run build
################################################################################
# Build the Application Image
################################################################################
FROM alpine:3.17
################################################################################
# Install Dependencies
################################################################################
RUN apk add --no-cache git bash curl g++
################################################################################
# Install PHP 8.1
################################################################################
RUN apk add --no-cache \
$( \
apk search -qe --no-cache 'php81*' \
| sed -e 's/[^ ]*dev[^ ]*//ig' \
| sed -e 's/[^ ]*psr[^ ]*//ig' \
| sed -e 's/[^ ]*xdebug[^ ]*//ig' \
| sed -e 's/[^ ]*couchbase[^ ]*//ig' \
| cat \
)
################################################################################
# Setup the Application
################################################################################
COPY --from=composer /app /var/www/html
COPY --from=node /app/public /var/www/html/public
RUN chmod -R 777 /var/www/html/storage
RUN chmod -R 777 /var/www/html/bootstrap/cache
RUN cp /var/www/html/.env.example /var/www/html/.env
RUN php81 /var/www/html/artisan key:generate
################################################################################
# Setup Cron
################################################################################
RUN echo "* * * * * php81 /var/www/html/artisan schedule:run >> \
/var/www/html/storage/logs/cron.log 2>&1" \
>> /var/spool/cron/crontabs/root
################################################################################
# Configure the Container
################################################################################
WORKDIR /var/www/html
EXPOSE 8000
################################################################################
# Start Web Server
################################################################################
CMD crond && php81 artisan octane:start --server=swoole --host=0.0.0.0