-
Notifications
You must be signed in to change notification settings - Fork 23
[WIP] Docker / go 1.6 updates #43
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,9 @@ | ||
FROM ubuntu:14.04 | ||
FROM golang:1.6.0 | ||
MAINTAINER Yann Malet <[email protected]> | ||
|
||
RUN locale-gen en_US.UTF-8 | ||
ENV LANG en_US.UTF-8 | ||
ENV LANGUAGE en_US:en | ||
ENV LC_ALL en_US.UTF-8 | ||
ENV PATH /usr/src/go/bin:$PATH | ||
ENV GOPATH /go | ||
ENV PATH /go/bin:$PATH | ||
ENV GOLANG_VERSION 1.3.1 | ||
ADD . /go/src/github.com/BotBotMe/botbot-bot/ | ||
WORKDIR /go/src/github.com/BotBotMe/botbot-bot/ | ||
|
||
RUN go get -u github.com/kardianos/govendor | ||
|
||
# SCMs for "go get", gcc for cgo | ||
RUN DEBIAN_FRONTEND=noninteractive apt-get update | ||
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \ | ||
ca-certificates curl gcc libc6-dev \ | ||
bzr git mercurial | ||
RUN rm -rf /var/lib/apt/lists/* | ||
RUN curl -sSL http://golang.org/dl/go$GOLANG_VERSION.src.tar.gz | tar -v -C /usr/src -xz | ||
|
||
RUN cd /usr/src/go/src && ./make.bash --no-clean 2>&1 | ||
|
||
RUN mkdir -p /go/src | ||
WORKDIR /go | ||
|
||
ENV GOPACKAGE github.com/BotBotMe/botbot-bot | ||
# Copy the local package files to the container's workspace. | ||
ADD . /go/src/$GOPACKAGE | ||
|
||
# Build the $GOPACKAGE command inside the container. | ||
# (You may fetch or manage dependencies here, | ||
# either manually or with a tool like "godep".) | ||
RUN go get $GOPACKAGE | ||
|
||
ENTRYPOINT /go/bin/botbot-bot -logtostderr=true | ||
CMD go run main.go -logtostderr=true |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
bot: | ||
build: . | ||
links: | ||
- redis | ||
- db | ||
volumes: | ||
- ./:/go/src/github.com/BotBotMe/botbot-bot/ | ||
|
||
redis: | ||
image: redis:latest | ||
ports: | ||
- 6379 | ||
|
||
db: | ||
image: postgres:9.5 | ||
ports: | ||
- "5432:5432" | ||
volumes: | ||
- ./init-db:/docker-entrypoint-initdb.d/ | ||
- ./sql:/pg-tmp/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This won't persist the DB, right? Would people want to use docker beyond just testing? Can we throw all Docker related stuff into a parent folder so it isn't cluttering the root of the repo? |
||
environment: | ||
POSTGRES_PASSWORD: docker | ||
POSTGRES_USER: postgres |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A short comment on what this file does and why it is necessary would be nice. |
||
set -e | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I typically use |
||
|
||
|
||
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<-EOSQL | ||
CREATE DATABASE botbot; | ||
GRANT ALL PRIVILEGES ON DATABASE botbot TO postgres; | ||
EOSQL | ||
|
||
|
||
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" botbot -c 'CREATE EXTENSION hstore;' | ||
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" botbot < /pg-tmp/schema.sql |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
docker-compose run bot go test -v ./... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, not sure how I feel about having Docker related stuff in the code. It's easy enough to build up the environment variable when starting the containers, right?