Skip to content

Instantly share code, notes, and snippets.

@nuriel77
Created January 11, 2020 08:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nuriel77/d62bfe7565ea46b34beb3abf7bdea9f4 to your computer and use it in GitHub Desktop.
Save nuriel77/d62bfe7565ea46b34beb3abf7bdea9f4 to your computer and use it in GitHub Desktop.
Can be used for any arch based on --build-args
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