-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Dockerfile.aarch64
121 lines (114 loc) · 3.94 KB
/
Dockerfile.aarch64
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
112
113
114
115
116
117
118
119
120
121
# syntax=docker/dockerfile:1
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm64v8-3.18
ARG BUILD_DATE
ARG VERSION
ARG MASTODON_VERSION
LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
LABEL maintainer="TheSpad"
ENV RAILS_ENV="production" \
NODE_ENV="production" \
NODE_OPTIONS="--openssl-legacy-provider" \
PATH="${PATH}:/app/www/bin" \
S6_STAGE2_HOOK="/init-hook"
RUN \
apk add --no-cache \
ffmpeg \
file \
imagemagick \
libpq \
libidn \
nodejs \
ruby \
ruby-bundler \
ruby-rdoc \
yaml && \
apk add --no-cache --virtual=build-dependencies \
build-base \
gcompat \
icu-dev \
libidn-dev \
libpq-dev \
libxml2-dev \
libxslt-dev \
openssl-dev \
python3-dev \
ruby-dev \
yaml-dev \
yarn && \
echo "**** install mastodon ****" && \
mkdir -p /app/www && \
if [ -z ${MASTODON_VERSION+x} ]; then \
MASTODON_VERSION=$(curl -sX GET "https://api.github.com/repos/mastodon/mastodon/releases/latest" \
| awk '/tag_name/{print $4;exit}' FS='[""]'); \
fi && \
curl -s -o \
/tmp/mastodon.tar.gz -L \
"https://github.com/mastodon/mastodon/archive/${MASTODON_VERSION}.tar.gz" && \
tar xf \
/tmp/mastodon.tar.gz -C \
/app/www/ --strip-components=1 && \
cd /app/www && \
# https://github.com/mastodon/mastodon/pull/24702
sed -En "s/.*\brequire\('([^']+)'\).*/\"\1\"/p" streaming/index.js > streaming-requires.txt && \
jq --slurpfile requires streaming-requires.txt \
'{ dependencies: .dependencies | with_entries(select([.key] | inside($requires))) }' \
package.json > streaming/package.json && \
bundle config set --local deployment 'true' && \
bundle config set --local without 'development test exclude' && \
bundle config set silence_root_warning true && \
bundle config set force_ruby_platform true && \
bundle install -j"$(nproc)" --no-cache && \
yarn install --production --frozen-lockfile --check-files && \
cd streaming && \
yarn install --production --check-files && \
OTP_SECRET=precompile_placeholder SECRET_KEY_BASE=precompile_placeholder rails assets:precompile && \
echo "**** cleanup ****" && \
yarn cache clean && \
apk del --purge \
build-dependencies && \
# Remove assets not needed in runtime because they were compiled & copied to public
rm -r \
/app/www/app/javascript/fonts \
/app/www/app/javascript/icons \
/app/www/app/javascript/packs \
/app/www/app/javascript/styles && \
rm -rf \
# Remove vendored sources for building native extensions.
/app/www/vendor/bundle/ruby/*/gems/hiredis-*/vendor/hiredis \
/app/www/vendor/bundle/ruby/*/gems/nokogiri-*/gumbo-parser \
/app/www/vendor/bundle/ruby/*/gems/nokogiri-*/patches \
/app/www/vendor/bundle/ruby/*/gems/pghero-*/app/assets \
# Remove build logs, temp files, and cache.
/app/www/vendor/bundle/ruby/*/build_info/ \
/app/www/vendor/bundle/ruby/*/cache/ \
/app/www/tmp/cache \
$HOME/.bundle/cache \
$HOME/.composer \
/tmp/* && \
find /app/www/vendor/bundle/ruby/*/extensions/ \( -name gem_make.out -o -name mkmf.log \) -delete && \
# Remove tests, documentations and other useless files.
find /app/www/vendor/bundle/ruby/*/gems/ \( -name 'doc' \
-o -name 'spec' \
-o -name 'test' \) \
-type d -maxdepth 2 -exec rm -fr "{}" + && \
find /app/www/vendor/bundle/ruby/*/gems/ \( -name 'README*' \
-o -name 'CHANGELOG*' \
-o -name 'CONTRIBUT*' \
-o -name '*LICENSE*' \
-o -name 'Rakefile' \
-o -name '.*' \) \
-type f -delete && \
# Remove source maps, TS files, docs, tests and other useless files.
find /app/www/streaming/node_modules \( -name '.*' \
-o -name '*.map' \
-o -name '*.md' \
-o -name '*.ts' \
-o -name 'LICENSE*' \
-o -name 'Makefile' \
-o -name 'README*' \) \
-type f -delete && \
rm -rf /app/www/streaming/node_modules/*/test && \
rm -rf /app/www/node_modules
COPY root/ /
EXPOSE 80 443
VOLUME /config