Skip to content

Commit

Permalink
Docker workflow improvemnet
Browse files Browse the repository at this point in the history
  • Loading branch information
ibnesayeed committed Oct 27, 2017
1 parent 0824ca1 commit 0704081
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ WORKDIR /go/src/github.com/datatogether/coverage
# Run tests
RUN go test

# Build the static api binary
# Build the static api binary for production
RUN CGO_ENABLED=0 GOOS=linux go install -a -installsuffix cgo

# Let gin watch and build by default in development environment
CMD ["gin", "-i"]
# Set binary as the default command
CMD ["coverage"]

# Start over from an Alpine Linux image as a base
# to create a minumal production image
Expand Down
17 changes: 8 additions & 9 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
version: '2'
version: '2.3'
services:
coverage:
build: .
build:
context: .
target: dev
env_file: .env
volumes:
- .:/go/src/github.com/datatogether/coverage
- ./sql:/sql
ports:
- $PORT:$PORT
- "$PORT:$PORT"
- "3000:3000"
networks:
- back-tier
depends_on:
- postgres
environment:
- PORT=$PORT
- TLS=false
- GOLANG_ENV=develop
- POSTGRES_DB_URL=postgres://postgres@postgres/postgres?sslmode=disable
- RPC_PORT=4400
command: gin -i -p 3000 -a $PORT
postgres:
image: "postgres:9.6-alpine"
networks:
Expand Down
4 changes: 4 additions & 0 deletions sample.env
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
PORT=8080
RPC_PORT=4400
TLS=false
GOLANG_ENV=develop
POSTGRES_DB_URL=postgres://postgres@postgres/postgres?sslmode=disable

0 comments on commit 0704081

Please sign in to comment.