Skip to content
This repository has been archived by the owner on Jan 26, 2018. It is now read-only.

Heroku compatible #38

Open
wants to merge 4 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
18 changes: 15 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,24 @@
# Build the docker image:
#
# docker build --rm=true -t lgtm/lgtm .
#
# Push to Heroku
#
# heroku container:push web

FROM golang:1.6

FROM centurylink/ca-certs
EXPOSE 8000

ENV DATABASE_DRIVER=sqlite3
ENV DATABASE_DATASOURCE=/var/lib/lgtm/lgtm.sqlite
ENV GO15VENDOREXPERIMENT=1

COPY . /go/src/github.com/lgtmco/lgtm
WORKDIR /go/src/github.com/lgtmco/lgtm

RUN make deps
RUN make gen
RUN make build

ADD lgtm /lgtm
ENTRYPOINT ["/lgtm"]
CMD ["/go/src/github.com/lgtmco/lgtm/lgtm"]
22 changes: 22 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: '2'
services:
app:
build: .
ports:
- 8000:8000
depends_on:
- mysql
links:
- mysql
env_file: .env
environment:
- DATABASE_DRIVER=mysql
- DATABASE_DATASOURCE=root:lgtm@tcp(mysql:3306)/lgtm?parseTime=true
- GITHUB_URL=https://github.com
- GITHUB_SCOPE=user:email,read:org,repo
- DEBUG=1
mysql:
image: mysql
environment:
MYSQL_ROOT_PASSWORD: lgtm
MYSQL_DATABASE: lgtm
7 changes: 4 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import (
)

var (
addr = envflag.String("SERVER_ADDR", ":8000", "")
port = envflag.String("PORT", "8000", "")
addr = envflag.String("SERVER_ADDR", "", "")
cert = envflag.String("SERVER_CERT", "", "")
key = envflag.String("SERVER_KEY", "", "")

Expand All @@ -40,11 +41,11 @@ func main() {

if *cert != "" {
logrus.Fatal(
http.ListenAndServeTLS(*addr, *cert, *key, handler),
http.ListenAndServeTLS(*addr + ":" + *port, *cert, *key, handler),
)
} else {
logrus.Fatal(
http.ListenAndServe(*addr, handler),
http.ListenAndServe(*addr + ":" + *port, handler),
)
}
}
Loading