forked from ppy/osu-web
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile.deployment
111 lines (82 loc) · 2.99 KB
/
Dockerfile.deployment
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
FROM --platform=$BUILDPLATFORM debian:12 as buildenv
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y apt-transport-https lsb-release ca-certificates curl gnupg
RUN curl -fsSLo /usr/share/keyrings/deb.sury.org-php.gpg https://packages.sury.org/php/apt.gpg
RUN echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /usr/share/keyrings/nodesource.gpg
RUN echo "deb [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" > /etc/apt/sources.list.d/nodesource.list
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \
build-essential \
git \
nodejs \
php8.3 \
php8.3-common \
php8.3-curl \
php8.3-ds \
php8.3-gd \
php8.3-intl \
php8.3-mbstring \
php8.3-mysql \
php8.3-redis \
php8.3-sqlite3 \
php8.3-swoole \
php8.3-tokenizer \
php8.3-xml \
php8.3-zip \
zip
RUN npm install -g yarn
WORKDIR /app
RUN curl -L "https://getcomposer.org/download/latest-2.x/composer.phar" > /usr/local/bin/composer && chmod 755 /usr/local/bin/composer
COPY composer.json composer.lock ./
RUN composer install --no-dev --no-scripts
COPY package.json yarn.lock ./
RUN yarn --prod --ignore-optional --frozen-lockfile
FROM debian:12 as runenv
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y apt-transport-https lsb-release ca-certificates curl
RUN curl -sSLo /usr/share/keyrings/deb.sury.org-php.gpg https://packages.sury.org/php/apt.gpg
RUN echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \
jhead \
nginx \
php8.3 \
php8.3-common \
php8.3-curl \
php8.3-ds \
php8.3-gd \
php8.3-intl \
php8.3-mbstring \
php8.3-mysql \
php8.3-redis \
php8.3-sqlite3 \
php8.3-swoole \
php8.3-tokenizer \
php8.3-xml \
php8.3-zip
RUN rm -f /var/log/nginx/access.log /var/log/nginx/error.log && \
ln -s /dev/stdout /var/log/nginx/access.log && \
ln -s /dev/stderr /var/log/nginx/error.log
FROM buildenv as build
COPY . .
RUN mkdir -p bootstrap/cache storage/logs storage/framework/cache storage/framework/views storage/framework/sessions public/uploads public/uploads-avatar public/uploads-replay
ARG APP_URL
ARG DOCS_URL
RUN yarn production
RUN php artisan ip2asn:update
RUN php artisan scribe:generate
RUN rm -rf node_modules
RUN composer dump-autoload
ARG GIT_SHA
RUN printf "%s" "$GIT_SHA" > version
FROM runenv as run
COPY --from=build /app /app
WORKDIR /app
RUN useradd -m osuweb
RUN chown -R osuweb /var/lib/nginx bootstrap/cache storage
USER osuweb
ENV LOG_CHANNEL stderr
EXPOSE 8000
EXPOSE 8080
ENTRYPOINT ["/app/docker/deployment/entrypoint.sh"]