Skip to content
This repository has been archived by the owner on Aug 1, 2019. It is now read-only.

Added x86 build for loc #8

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 113 additions & 0 deletions Dockerfile.x86
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
FROM multiarch/alpine:x86-v3.7
MAINTAINER wessel<[email protected]>

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment on local availability is wrong here, it should stand with the LocalPort as its name also clearly states.

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"
38 changes: 38 additions & 0 deletions doc/Docker.MD
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 7 additions & 2 deletions docker/iop-loc.yaml
Original file line number Diff line number Diff line change
@@ -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: 386
os: linux