2021-11-08 21:51:29 +00:00
|
|
|
FROM node:16.13.0-alpine3.14 AS builder
|
2021-07-07 20:45:37 +00:00
|
|
|
WORKDIR /otterscan-build
|
2021-07-11 02:22:17 +00:00
|
|
|
COPY ["package.json", "package-lock.json", "/otterscan-build/"]
|
2021-07-07 20:45:37 +00:00
|
|
|
RUN npm install
|
2021-07-11 02:22:17 +00:00
|
|
|
COPY ["run-nginx.sh", "tsconfig.json", "craco.config.js", "tailwind.config.js", "/otterscan-build/"]
|
|
|
|
COPY ["public", "/otterscan-build/public/"]
|
|
|
|
COPY ["src", "/otterscan-build/src/"]
|
2021-07-07 20:45:37 +00:00
|
|
|
RUN npm run build
|
|
|
|
|
2021-07-10 00:11:52 +00:00
|
|
|
FROM alpine:3.14.0 AS logobuilder
|
|
|
|
RUN apk add imagemagick parallel
|
|
|
|
WORKDIR /assets
|
2022-02-25 19:06:10 +00:00
|
|
|
COPY trustwallet/blockchains/ethereum/assets /assets/1/
|
2022-02-26 00:52:54 +00:00
|
|
|
COPY trustwallet/blockchains/polygon/assets /assets/137/
|
|
|
|
COPY trustwallet/blockchains/smartchain/assets /assets/56/
|
|
|
|
RUN find . -name logo.png | parallel magick convert {} -filter Lanczos -resize 32x32 {}; exit 0
|
2021-07-10 00:11:52 +00:00
|
|
|
|
2021-09-27 18:40:01 +00:00
|
|
|
FROM alpine:3.14.0 AS fourbytesbuilder
|
|
|
|
WORKDIR /signatures
|
|
|
|
COPY 4bytes/signatures /signatures/
|
|
|
|
COPY 4bytes/with_parameter_names /signatures/
|
|
|
|
|
2021-10-07 23:31:36 +00:00
|
|
|
FROM alpine:3.14.0 AS topic0builder
|
|
|
|
WORKDIR /topic0
|
|
|
|
COPY topic0/with_parameter_names /topic0/
|
|
|
|
|
2021-10-20 18:44:27 +00:00
|
|
|
# Add brotli module to official nginx image
|
|
|
|
# Based on: https://github.com/nginxinc/docker-nginx/tree/master/modules
|
|
|
|
FROM nginx:1.21.3-alpine as nginxbuilder
|
|
|
|
|
|
|
|
RUN set -ex \
|
|
|
|
&& apk update \
|
|
|
|
&& apk add linux-headers openssl-dev pcre-dev zlib-dev openssl abuild \
|
|
|
|
musl-dev libxslt libxml2-utils make mercurial gcc unzip git \
|
|
|
|
xz g++ coreutils \
|
|
|
|
# allow abuild as a root user \
|
|
|
|
&& printf "#!/bin/sh\\nSETFATTR=true /usr/bin/abuild -F \"\$@\"\\n" > /usr/local/bin/abuild \
|
|
|
|
&& chmod +x /usr/local/bin/abuild \
|
|
|
|
&& hg clone -r ${NGINX_VERSION}-${PKG_RELEASE} https://hg.nginx.org/pkg-oss/ \
|
|
|
|
&& cd pkg-oss \
|
|
|
|
&& mkdir /tmp/packages \
|
|
|
|
&& for module in "brotli"; do \
|
|
|
|
echo "Building $module for nginx-$NGINX_VERSION"; \
|
|
|
|
if [ -d /modules/$module ]; then \
|
|
|
|
echo "Building $module from user-supplied sources"; \
|
|
|
|
# check if module sources file is there and not empty
|
|
|
|
if [ ! -s /modules/$module/source ]; then \
|
|
|
|
echo "No source file for $module in modules/$module/source, exiting"; \
|
|
|
|
exit 1; \
|
|
|
|
fi; \
|
|
|
|
# some modules require build dependencies
|
|
|
|
if [ -f /modules/$module/build-deps ]; then \
|
|
|
|
echo "Installing $module build dependencies"; \
|
|
|
|
apk update && apk add $(cat /modules/$module/build-deps | xargs); \
|
|
|
|
fi; \
|
|
|
|
# if a module has a build dependency that is not in a distro, provide a
|
|
|
|
# shell script to fetch/build/install those
|
|
|
|
# note that shared libraries produced as a result of this script will
|
|
|
|
# not be copied from the builder image to the main one so build static
|
|
|
|
if [ -x /modules/$module/prebuild ]; then \
|
|
|
|
echo "Running prebuild script for $module"; \
|
|
|
|
/modules/$module/prebuild; \
|
|
|
|
fi; \
|
|
|
|
/pkg-oss/build_module.sh -v $NGINX_VERSION -f -y -o /tmp/packages -n $module $(cat /modules/$module/source); \
|
|
|
|
BUILT_MODULES="$BUILT_MODULES $(echo $module | tr '[A-Z]' '[a-z]' | tr -d '[/_\-\.\t ]')"; \
|
|
|
|
elif make -C /pkg-oss/alpine list | grep -E "^$module\s+\d+" > /dev/null; then \
|
|
|
|
echo "Building $module from pkg-oss sources"; \
|
|
|
|
cd /pkg-oss/alpine; \
|
|
|
|
make abuild-module-$module BASE_VERSION=$NGINX_VERSION NGINX_VERSION=$NGINX_VERSION; \
|
|
|
|
apk add $(. ./abuild-module-$module/APKBUILD; echo $makedepends;); \
|
|
|
|
make module-$module BASE_VERSION=$NGINX_VERSION NGINX_VERSION=$NGINX_VERSION; \
|
|
|
|
find ~/packages -type f -name "*.apk" -exec mv -v {} /tmp/packages/ \;; \
|
|
|
|
BUILT_MODULES="$BUILT_MODULES $module"; \
|
|
|
|
else \
|
|
|
|
echo "Don't know how to build $module module, exiting"; \
|
|
|
|
exit 1; \
|
|
|
|
fi; \
|
|
|
|
done \
|
|
|
|
&& echo "BUILT_MODULES=\"$BUILT_MODULES\"" > /tmp/packages/modules.env
|
|
|
|
|
|
|
|
FROM nginx:1.21.3-alpine
|
|
|
|
COPY --from=nginxbuilder /tmp/packages /tmp/packages
|
|
|
|
RUN set -ex \
|
|
|
|
&& . /tmp/packages/modules.env \
|
|
|
|
&& for module in $BUILT_MODULES; do \
|
|
|
|
apk add --no-cache --allow-untrusted /tmp/packages/nginx-module-${module}-${NGINX_VERSION}*.apk; \
|
|
|
|
done \
|
|
|
|
&& rm -rf /tmp/packages
|
|
|
|
RUN apk update && apk add jq
|
2021-10-07 23:31:36 +00:00
|
|
|
COPY --from=topic0builder /topic0 /usr/share/nginx/html/topic0/
|
2021-09-27 18:40:01 +00:00
|
|
|
COPY --from=fourbytesbuilder /signatures /usr/share/nginx/html/signatures/
|
2021-07-10 00:11:52 +00:00
|
|
|
COPY --from=logobuilder /assets /usr/share/nginx/html/assets/
|
2021-10-20 14:34:35 +00:00
|
|
|
COPY nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf
|
2021-10-20 14:45:58 +00:00
|
|
|
COPY nginx/nginx.conf /etc/nginx/nginx.conf
|
2021-07-07 20:45:37 +00:00
|
|
|
COPY --from=builder /otterscan-build/build /usr/share/nginx/html/
|
2021-07-08 00:57:03 +00:00
|
|
|
COPY --from=builder /otterscan-build/run-nginx.sh /
|
|
|
|
WORKDIR /
|
|
|
|
|
|
|
|
CMD ["/run-nginx.sh"]
|