Skip to content

Commit

Permalink
Setup automated build to Docker Hub
Browse files Browse the repository at this point in the history
  • Loading branch information
placer14 committed Jan 19, 2018
1 parent ef24a1c commit 6db842e
Show file tree
Hide file tree
Showing 5 changed files with 182 additions and 19 deletions.
18 changes: 10 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
FROM golang:1.9

ENV APP_PATH=github.com/placer14/ob-crawler

WORKDIR /go/src/$APP_PATH

FROM golang:1.8.1
WORKDIR /go/src/github.com/placer14/ob-crawler
RUN go get gopkg.in/jarcoal/httpmock.v1

COPY ./src .
RUN go test ./... && \
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o /opt/ob-crawler .

FROM scratch
WORKDIR /opt
COPY --from=0 /opt/ob-crawler /opt/ob-crawler
ENTRYPOINT ["/opt/ob-crawler"]
CMD ["-help"]

ENTRYPOINT ["/bin/bash"]
11 changes: 11 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM golang:1.9

ENV APP_PATH=github.com/placer14/ob-crawler

WORKDIR /go/src/$APP_PATH

RUN go get gopkg.in/jarcoal/httpmock.v1

COPY ./src .

ENTRYPOINT ["/bin/bash"]
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
The Challenge
===
# OpenBazaar Crawler

### The Challenge

Using Go write an OpenBazaar network crawler that logs the total number of listings on the network. The crawler may connect to a running openbazaar-go instance and use the API.

Expand Down
145 changes: 145 additions & 0 deletions config/openbazaar.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
{
"API": {
"HTTPHeaders": null
},
"Addresses": {
"API": "0.0.0.0",
"Announce": null,
"Gateway": "/ip4/0.0.0.0/tcp/4002",
"NoAnnounce": null,
"Swarm": [
"/ip4/0.0.0.0/tcp/4001",
"/ip6/::/tcp/4001",
"/ip4/0.0.0.0/tcp/9005/ws",
"/ip6/::/tcp/9005/ws"
]
},
"Bootstrap": [
"/ip4/107.170.133.32/tcp/4001/ipfs/QmUZRGLhcKXF1JyuaHgKm23LvqcoMYwtb9jmh8CkP4og3K",
"/ip4/139.59.174.197/tcp/4001/ipfs/QmZfTbnpvPwxCjpCG3CXJ7pfexgkBZ2kgChAiRJrTK1HsM",
"/ip4/139.59.6.222/tcp/4001/ipfs/QmRDcEDK9gSViAevCHiE6ghkaBCU7rTuQj4BDpmCzRvRYg",
"/ip4/46.101.198.170/tcp/4001/ipfs/QmePWxsFT9wY3QuukgVDB7XZpqdKhrqJTHTXU7ECLDWJqX"
],
"Bootstrap-testnet": [
"/ip4/165.227.117.91/tcp/4001/ipfs/Qmaa6De5QYNqShzPb9SGSo8vLmoUte8mnWgzn4GYwzuUYA",
"/ip4/46.101.221.165/tcp/4001/ipfs/QmVAQYg7ygAWTWegs8HSV2kdW1MqW8WMrmpqKG1PQtkgTC"
],
"DataSharing": {
"AcceptStoreRequests": false,
"PushTo": [
"QmY8puEnVx66uEet64gAf4VZRo7oUyMCwG6KdB9KM92EGQ",
"QmPPg2qeF3n2KvTRXRZLaTwHCw8JxzF4uZK93RfMoDvf2o"
]
},
"Datastore": {
"BloomFilterSize": 0,
"GCPeriod": "1h",
"HashOnRead": false,
"Spec": {
"mounts": [
{
"child": {
"path": "blocks",
"shardFunc": "/repo/flatfs/shard/v1/next-to-last/2",
"sync": true,
"type": "flatfs"
},
"mountpoint": "/blocks",
"prefix": "flatfs.datastore",
"type": "measure"
},
{
"child": {
"compression": "none",
"path": "datastore",
"type": "levelds"
},
"mountpoint": "/",
"prefix": "leveldb.datastore",
"type": "measure"
}
],
"type": "mount"
},
"StorageGCWatermark": 90,
"StorageMax": "10GB"
},
"Discovery": {
"MDNS": {
"Enabled": false,
"Interval": 10
}
},
"Dropbox-api-token": "",
"Experimental": {
"FilestoreEnabled": false,
"Libp2pStreamMounting": false,
"ShardingEnabled": false
},
"Gateway": {
"HTTPHeaders": null,
"PathPrefixes": [],
"RootRedirect": "",
"Writable": false
},
"Identity": {
"PeerID": ""
},
"Ipns": {
"QuerySize": 5,
"RecordLifetime": "7d",
"RepublishPeriod": "24h",
"ResolveCacheSize": 128,
"UsePersistentCache": true
},
"JSON-API": {
"AllowedIPs": [],
"Authenticated": false,
"CORS": null,
"Enabled": true,
"HTTPHeaders": null,
"Password": "",
"SSL": false,
"SSLCert": "",
"SSLKey": "",
"Username": ""
},
"Mounts": {
"FuseAllowOther": false,
"IPFS": "/ipfs",
"IPNS": "/ipns"
},
"Reprovider": {
"Interval": "",
"Strategy": ""
},
"RepublishInterval": "24h",
"Resolvers": {
".eth": "",
".id": "https://resolver.onename.com/"
},
"SupernodeRouting": {
"Servers": null
},
"Swarm": {
"AddrFilters": null,
"DisableBandwidthMetrics": false,
"DisableNatPortMap": false,
"DisableRelay": false,
"EnableRelayHop": false
},
"Tor-config": {
"Password": "",
"TorControl": ""
},
"Wallet": {
"Binary": "",
"FeeAPI": "https://btc.fees.openbazaar.org",
"HighFeeDefault": 160,
"LowFeeDefault": 20,
"MaxFee": 2000,
"MediumFeeDefault": 60,
"TrustedPeer": "",
"Type": "spvwallet"
}
}
22 changes: 13 additions & 9 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
version: '3'
services:
api:
image: openbazaar/server:v0.11.0-rc2
volumes:
- obdata:/var/lib/openbazaar
ports:
- "4002:4002" # API
crawler:
#api:
#image: openbazaar/server:v0.11.0-rc2
#volumes:
#- obdata:/var/lib/openbazaar
#ports:
#- "4002:4002" # API
prod:
build: .
crawler:
build:
context: .
dockerfile: ./Dockerfile.dev
volumes:
- obdata:/var/lib/openbazaar
- ./src:/go/src/github.com/placer14/ob-crawler
- ./config:/root/config
depends_on:
- api
#depends_on:
#- api

volumes:
obdata:

0 comments on commit 6db842e

Please sign in to comment.