Created
January 11, 2020 08:38
-
-
Save nuriel77/d62bfe7565ea46b34beb3abf7bdea9f4 to your computer and use it in GitHub Desktop.
Can be used for any arch based on --build-args
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
FROM alpine:latest | |
WORKDIR /app | |
LABEL org.label-schema.description="HORNET - The IOTA community node" | |
LABEL org.label-schema.name="gohornet/hornet" | |
LABEL org.label-schema.schema-version="1.0" | |
LABEL org.label-schema.vcs-url="https://github.com/gohornet/hornet" | |
LABEL org.label-schema.usage="https://github.com/gohornet/hornet/blob/master/DOCKER.md" | |
ARG ARCH=x86_64 | |
ARG OS=Linux | |
ARG TAG=latest | |
ARG REPO="gohornet/hornet" | |
RUN apk --no-cache add --update ca-certificates tar tini jq curl\ | |
&& if [ "$TAG" = "latest" ]; then HORNET_TAG=$(curl --retry 3 -f -s https://api.github.com/repos/${REPO}/releases/latest | jq -r .tag_name | tr -d 'v'); else HORNET_TAG="${TAG//v}";fi\ | |
&& echo "Downloading from https://github.com/${REPO}/releases/download/v${HORNET_TAG}/HORNET-${HORNET_TAG}_${OS}_${ARCH}.tar.gz ..."\ | |
&& curl -f -L --retry 3 "https://github.com/${REPO}/releases/download/v${HORNET_TAG}/HORNET-${HORNET_TAG}_${OS}_${ARCH}.tar.gz" -o /tmp/hornet.tgz\ | |
&& tar --wildcards --strip-components=1 -xf /tmp/hornet.tgz -C /app/ */hornet */config.json */neighbors.json\ | |
&& rm /tmp/hornet.tgz\ | |
&& addgroup --gid 39999 hornet\ | |
&& adduser -h /app -s /bin/sh -G hornet -u 39999 -D hornet\ | |
&& chmod +x /app/hornet\ | |
&& chown hornet:hornet -R /app\ | |
&& apk del jq curl | |
# Not exposing ports, as it might be more efficient to run this on host network because of performance gain. | |
# | Host mode networking can be useful to optimize performance, and in situations where a container needs | |
# | to handle a large range of ports, as it does not require network address translation (NAT), and no | |
# | “userland-proxy” is created for each port. | |
# Source: https://docs.docker.com/network/host/ | |
USER hornet | |
ENTRYPOINT ["/sbin/tini", "--", "/app/hornet"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment