Skip to content
This repository was archived by the owner on May 16, 2019. It is now read-only.

Commit c5238f7

Browse files
committed
added docker support
added docker instructions to README
1 parent 9722851 commit c5238f7

File tree

5 files changed

+86
-17
lines changed

5 files changed

+86
-17
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,6 @@ target/
5959

6060
.idea/
6161
_trial_temp/
62+
63+
# Docker data
64+
data/

Dockerfile

Lines changed: 37 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,43 @@
1-
FROM ubuntu:14.04
2-
3-
MAINTAINER Joshua Sindy <[email protected]>
4-
# Examples
5-
# docker build -t observer .
6-
# docker run --rm -it -e flags="--help" observer
7-
# docker run -d --name observer -e flags="--testnet" observer
8-
# docker logs observer
9-
10-
RUN apt-get update
11-
RUN apt-get install -y python-dev python-pip build-essential git libffi-dev libssl-dev
12-
RUN pip install pyopenssl ndg-httpsclient pyasn1
13-
RUN pip install --upgrade pip virtualenv
14-
RUN pip install mock coverage nose pylint
1+
FROM ubuntu:15.04
2+
MAINTAINER eiabea <[email protected]>
3+
4+
# Install required Debian packages
5+
RUN set -ex \
6+
&& echo "deb http://us.archive.ubuntu.com/ubuntu vivid main universe" | tee -a /etc/apt/sources.list \
7+
&& apt-get update -q \
8+
&& apt-get install -q -y build-essential libssl-dev libffi-dev python-dev openssl python-pip libzmq3-dev libsodium-dev autoconf automake pkg-config libtool git \
9+
&& apt-get clean autoclean -q -y \
10+
&& apt-get autoremove -q -y \
11+
&& rm -rf /var/lib/apt/lists/* /var/lib/apt/lists/partial/* /tmp/* /var/tmp/*
12+
13+
# Install libzmq from github
14+
RUN git clone https://github.com/zeromq/libzmq
15+
WORKDIR /libzmq
16+
RUN ./autogen.sh
17+
RUN ./configure
18+
RUN make
19+
RUN make install
20+
RUN ldconfig
21+
22+
# Install cryptography
23+
WORKDIR /
24+
RUN pip install cryptography
25+
26+
# Install Openbazaar-Server from github
1527
RUN git clone https://github.com/OpenBazaar/OpenBazaar-Server.git
1628
WORKDIR /OpenBazaar-Server/
17-
RUN pip install -r requirements.txt && pip install -r test_requirements.txt
29+
RUN pip install -r requirements.txt -r test_requirements.txt
1830
RUN make
31+
32+
# Copy entrypoint script and mark it executable
33+
COPY ./docker-entrypoint.sh /docker-entrypoint.sh
34+
RUN chmod +x /docker-entrypoint.sh
35+
36+
# Create Openbazaar user and set correct permissions
1937
RUN adduser --disabled-password --gecos \"\" openbazaar
2038
RUN chown -R openbazaar:openbazaar /OpenBazaar-Server
2139

22-
USER openbazaar
23-
CMD python openbazaard.py start $flags
40+
VOLUME /root/.openbazaar
41+
42+
ENTRYPOINT ["/docker-entrypoint.sh"]
43+
CMD ["python", "openbazaard.py", "start"]

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,12 @@ optional arguments:
4545
--pidfile PIDFILE name of the pid file
4646
```
4747

48+
## Docker
49+
Install [Docker](https://docs.docker.com/engine/installation/).
50+
Install [DockerCompose](https://docs.docker.com/compose/install/).
51+
52+
53+
54+
4855
## License
4956
OpenBazaar Server is licensed under the [MIT License](LICENSE).

docker-compose.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
version: "2"
2+
3+
services:
4+
openbazaard:
5+
build: "."
6+
network_mode: "host"
7+
ports:
8+
- "18467:18467"
9+
- "18469:18469/udp"
10+
- "18466:18466"
11+
- "18470:18470"
12+
volumes:
13+
- "./data:/root/.openbazaar"
14+
environment:
15+
# Should be changed to more secure values
16+
- "USERNAME=username"
17+
- "PASSWORD=password"

docker-entrypoint.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
set_username() {
6+
sedEscapedValue="$(echo "$1" | sed 's/[\/&]/\\&/g')"
7+
sed -ri "s/^#?(USERNAME\s*=\s*)\S+/\1$sedEscapedValue/" "/OpenBazaar-Server/ob.cfg"
8+
}
9+
10+
set_password() {
11+
sedEscapedValue="$(echo "$1" | sed 's/[\/&]/\\&/g')"
12+
sed -ri "s/^#?(PASSWORD\s*=\s*)\S+/\1$sedEscapedValue/" "/OpenBazaar-Server/ob.cfg"
13+
}
14+
15+
echo "Setting username"
16+
set_username $USERNAME
17+
18+
echo "Setting password"
19+
set_password $PASSWORD
20+
21+
echo "Executing ${@}"
22+
exec "$@"

0 commit comments

Comments
 (0)