From d3b53edd2b8bab4515c510473b372f169064064a Mon Sep 17 00:00:00 2001 From: Wessel Pieterse Date: Sun, 2 Dec 2018 21:28:34 +0200 Subject: [PATCH 1/2] Added x86 build for loc --- Dockerfile.x86 | 113 ++++++++++++++++++++++++++++++++++++++++++++ doc/Docker.MD | 38 +++++++++++++++ docker/iop-loc.yaml | 9 +++- 3 files changed, 158 insertions(+), 2 deletions(-) create mode 100644 Dockerfile.x86 diff --git a/Dockerfile.x86 b/Dockerfile.x86 new file mode 100644 index 0000000..d67bd9c --- /dev/null +++ b/Dockerfile.x86 @@ -0,0 +1,113 @@ +FROM multiarch/alpine:x86-v3.7 +MAINTAINER wessel + +ENV IOP_VERSION v1.2-Beta +ENV IOP_PLATFORM linux-64 + + +# Ports for node2node, client2node, interprocess communication between local services +EXPOSE 16980 +EXPOSE 16981 +EXPOSE 16982 + + +# Public node id, should be an SHA256 hash of the public key of this node +#ENV NODEID + +# TCP port to serve client (i.e. end user) queries. Optional,default value: 16981 +ENV CLIENTPORT 16981 + +# TCP port to serve other IoP services running on this node. Optional, default value: 16982 +ENV LOCALPORT 16982 + +# TCP port to serve node to node communication. Optional, default value: 16980 +#Should only be locally available +ENV NODEPORT 16980 + +ENV IOPLOC_PATH "/data/locnet/" + +# Path to config file to load options from. Optional, default value: ~/.iop-locnet/iop-locnet.cfg +ENV CONFIGFILE "/data/locnet/iop-locnet.cfg" + +#Path to db file. Optional, default value: ~/.iop-locnet/locnet.sqlite +ENV DBPATH "/data/locnet/iop-locnet.sqlite" + +# Path to log file. Optional, default value: ~/.iop-locnet/debug.log +ENV LOGPATH "/data/locnet/debug.log" + +# Externally accessible IP address (ipv4 or v6) to be advertised for other nodes or clients. Required for seeds only, autodetected otherwise. +#ENV HOST + +# GPS latitude of this server as real number from range ((-90,90) +#ENV LATITUDE 48.2081743 + +# GPS longitude of this server as real number from range (-180,180) +#ENV LONGITUDE 16.3738189 + +# Host name of seed node to be used instead of default seeds. You can repeat this option to define multiple custom seed nodes. +#ENV SEEDNODE + +#allows specifying any network device considered as local network instead of localhost +ENV LOCALDEVICE "127.0.0.1" + + + +#add glibc +RUN ALPINE_GLIBC_BASE_URL="https://github.com/sgerrand/alpine-pkg-glibc/releases/download" && \ + ALPINE_GLIBC_PACKAGE_VERSION="2.26-r0" && \ + ALPINE_GLIBC_BASE_PACKAGE_FILENAME="glibc-$ALPINE_GLIBC_PACKAGE_VERSION.apk" && \ + ALPINE_GLIBC_BIN_PACKAGE_FILENAME="glibc-bin-$ALPINE_GLIBC_PACKAGE_VERSION.apk" && \ + ALPINE_GLIBC_I18N_PACKAGE_FILENAME="glibc-i18n-$ALPINE_GLIBC_PACKAGE_VERSION.apk" && \ + apk add --no-cache --virtual=.build-dependencies wget ca-certificates && \ + wget \ + "https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub" \ + -O "/etc/apk/keys/sgerrand.rsa.pub" && \ + wget \ + "$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_BASE_PACKAGE_FILENAME" \ + "$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" \ + "$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_I18N_PACKAGE_FILENAME" && \ + apk add --no-cache \ + "$ALPINE_GLIBC_BASE_PACKAGE_FILENAME" \ + "$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" \ + "$ALPINE_GLIBC_I18N_PACKAGE_FILENAME" && \ + \ + rm "/etc/apk/keys/sgerrand.rsa.pub" && \ + /usr/glibc-compat/bin/localedef --force --inputfile POSIX --charmap UTF-8 C.UTF-8 || true && \ + echo "export LANG=C.UTF-8" > /etc/profile.d/locale.sh && \ + \ + apk del glibc-i18n && \ + \ + rm "/root/.wget-hsts" && \ + apk del .build-dependencies && \ + rm \ + "$ALPINE_GLIBC_BASE_PACKAGE_FILENAME" \ + "$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" \ + "$ALPINE_GLIBC_I18N_PACKAGE_FILENAME" + +# Protobuf 3.5 +RUN apk add --update protobuf protobuf-dev \ +&& /usr/glibc-compat/sbin/ldconfig + + +# Get the loc sourcecode +COPY . iop-locnet +ADD docker/run.sh run.sh + +RUN apk add --update --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ g++ make automake autoconf libspatialite-dev cmake sqlite-dev linux-headers \ +&& cd /iop-locnet/generated && ./regenerate.sh && cd .. \ +&& rm -rf build && mkdir build && cd build && cmake .. && make install \ +&& cd / rm -r iop-locnet && apk del g++ make automake autoconf cmake protobuf-dev linux-headers && rm -rf /var/cache/apk/* \ +&& chmod +x run.sh && mkdir -p $IOPLOC_PATH \ +&& adduser -D -h $IOPLOC_PATH -u 1000 iop \ +&& chown iop:iop $IOPLOC_PATH && chmod 755 $IOPLOC_PATH && chown iop:iop /usr/local/bin/iop-locnetd + +# Call uid 1000 "loc" +USER iop + +# Expose the fs-repo as a volume. +# We're doing this down here (and not at the top), +# so that the overlay directory is owned by the loc user. +# start_loc initializes an ephemeral fs-repo if none is mounted, +# which is why uid=1000 needs write permissions there. +VOLUME $IOPLOC_PATH +ENTRYPOINT "/run.sh" \ No newline at end of file diff --git a/doc/Docker.MD b/doc/Docker.MD index 5cf1a09..4298359 100644 --- a/doc/Docker.MD +++ b/doc/Docker.MD @@ -78,6 +78,44 @@ This is only needed if the container is needed by other people docker push libertaria/iop-loc:amd64-v2.0.0 ``` +## x86 + +### Build the container +``` +docker build -f Dockerfile.x86 -t libertaria/iop-loc:x86-v2.0.0 . +``` + +### Run the container + +``` +docker run \ +-e NODEID=058ab41184872391449f17d092f4c240ed87e3e9 \ +-e PUBLIC_IP=109.41.3.136 \ +-e LATITUDE=52.4713 \ +-e LONGITUDE=13.5168 \ +-e CONFIGFILE=/data/locnet/iop-locnet.cfg \ +-e DBPATH=/data/locnet/iop-locnet.sqlite \ +-e LOCALPORT=16982 \ +-e CLIENTPORT=16981 \ +-e IOPLOC_PATH=/data/locnet/ \ +-e NODEPORT=16980 \ +-e LOGPATH=/data/locnet/debug.log \ +-e LOCALDEVICE= 172.17.0.1 \ +-p 16980:16980 \ +-p 16981:16981 \ +-p 16982:16982 \ +libertaria/iop-loc:x86-v2.0.0 +``` + +### Push the container + +This is only needed if the container is needed by other people + +``` +docker push libertaria/iop-loc:x86-v2.0.0 +``` + + ## Manifest manifest-tool push from-spec docker/iop-loc.yaml diff --git a/docker/iop-loc.yaml b/docker/iop-loc.yaml index cf00857..2ce3596 100644 --- a/docker/iop-loc.yaml +++ b/docker/iop-loc.yaml @@ -1,12 +1,17 @@ image: libertaria/iop-loc:latest manifests: - - image: libertaria/iop-loc:2.0.0-rc1 + image: libertaria/iop-loc:amd64-v2.0.0 platform: architecture: amd64 os: linux - - image: libertaria/iop-loc:2.0.0-rc1 + image: libertaria/iop-loc:arm7-v2.0.0 platform: architecture: arm + os: linux + - + image: libertaria/iop-loc:x86-v2.0.0 + platform: + architecture: x86 os: linux \ No newline at end of file From a3dcdfc3a108b92d376d3600330e1f987293ce71 Mon Sep 17 00:00:00 2001 From: Wessel Pieterse Date: Sun, 2 Dec 2018 21:34:56 +0200 Subject: [PATCH 2/2] changed manifest from m x86 to 386 --- docker/iop-loc.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/iop-loc.yaml b/docker/iop-loc.yaml index 2ce3596..00f7665 100644 --- a/docker/iop-loc.yaml +++ b/docker/iop-loc.yaml @@ -13,5 +13,5 @@ manifests: - image: libertaria/iop-loc:x86-v2.0.0 platform: - architecture: x86 + architecture: 386 os: linux \ No newline at end of file