This repository has been archived by the owner on Feb 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/dockerfile' into 'master'
Switch to a multi-stage build for smaller image size See merge request ix.ai/crypto-exporter!64
- Loading branch information
Showing
6 changed files
with
55 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,49 @@ | ||
FROM alpine:latest as builder | ||
COPY exporter/requirements.txt /work/exporter/requirements.txt | ||
RUN set -xeu; \ | ||
mkdir -p /work/wheels; \ | ||
apk add \ | ||
python3-dev \ | ||
openssl-dev \ | ||
gcc \ | ||
musl-dev \ | ||
libffi-dev \ | ||
make \ | ||
; \ | ||
python3 -m ensurepip; \ | ||
pip3 install -U \ | ||
pip \ | ||
wheel \ | ||
; | ||
RUN pip3 --use-feature=2020-resolver wheel -r /work/exporter/requirements.txt -w /work/wheels | ||
COPY exporter /work/exporter/ | ||
|
||
FROM alpine:latest | ||
LABEL maintainer="[email protected]" \ | ||
ai.ix.repository="ix.ai/crypto-exporter" | ||
LABEL maintainer="[email protected]" | ||
LABEL ai.ix.repository="ix.ai/crypto-exporter" | ||
|
||
COPY --from=builder /work / | ||
|
||
COPY exporter/requirements.txt /exporter/requirements.txt | ||
RUN set -xeu; \ | ||
ls -lashi /wheels; \ | ||
apk add --no-cache python3; \ | ||
python3 -m ensurepip; \ | ||
pip3 install --no-cache-dir -U pip;\ | ||
pip3 install \ | ||
--no-index \ | ||
--use-feature=2020-resolver \ | ||
--no-cache-dir \ | ||
--find-links /wheels \ | ||
--requirement /exporter/requirements.txt \ | ||
; \ | ||
rm -rf /wheels; \ | ||
addgroup crypto-exporter; \ | ||
adduser -G crypto-exporter -D -H crypto-exporter | ||
|
||
RUN apk --no-cache upgrade && \ | ||
apk add --no-cache py3-prometheus-client \ | ||
py3-requests \ | ||
py3-cryptography \ | ||
py3-multidict \ | ||
py3-aiohttp \ | ||
py3-pip \ | ||
py3-toml \ | ||
py3-numpy \ | ||
py3-pynacl \ | ||
py3-urllib3 \ | ||
py3-yarl && \ | ||
apk add --no-cache python3-dev gcc musl-dev libffi-dev make && \ | ||
pip3 install --no-cache-dir -r exporter/requirements.txt && \ | ||
apk del --purge --no-cache gcc musl-dev python3-dev py3-pip libffi-dev | ||
COPY crypto-exporter /usr/local/bin/crypto-exporter | ||
|
||
COPY exporter/ /exporter | ||
COPY crypto-exporter.sh /usr/local/bin/crypto-exporter.sh | ||
USER crypto-exporter:crypto-exporter | ||
|
||
EXPOSE 9188 | ||
|
||
ENTRYPOINT ["/usr/local/bin/crypto-exporter.sh"] | ||
ENTRYPOINT ["/usr/local/bin/crypto-exporter"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
#!/usr/bin/env sh | ||
|
||
echo "Setting VERSION" | ||
find . -name .git -type d -prune -o -type f -name constants.py -exec sed -i s/^VERSION.*/VERSION\ =\ \'${CI_COMMIT_REF_NAME:-None}\'/g {} + -exec grep VERSION {} + | ||
echo "Setting BUILD" | ||
find . -name .git -type d -prune -o -type f -name constants.py -exec sed -i s/^BUILD.*/BUILD\ =\ \'${CI_PIPELINE_ID:-None}\'/g {} + -exec grep BUILD {} + | ||
set -xeu | ||
|
||
if [ -n "${CI_PIPELINE_ID:-}" ]; then | ||
sed -i "s|^BUILD.*|BUILD = '${CI_PIPELINE_ID}'|g" exporter/lib/constants.py | ||
fi |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
ccxt==1.36.80 | ||
prometheus_client==0.8.0 | ||
requests==2.24.0 | ||
pygelf==0.3.6 | ||
stellar-sdk==2.8.1 | ||
ccxt==1.36.80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters