Skip to content

Instantly share code, notes, and snippets.

@filipecifali
Created February 27, 2019 14:22
Show Gist options
  • Save filipecifali/00a524cb9167f1d4be7daf0e92495ec3 to your computer and use it in GitHub Desktop.
Save filipecifali/00a524cb9167f1d4be7daf0e92495ec3 to your computer and use it in GitHub Desktop.
Docker for go dev and prod
version: '3.4'
services:
base:
build:
context: ./
target: base
image: base:latest
ports:
- "3000:3001"
entrypoint:
- /src/server
env_file:
- .env
base_dev:
build:
context: ./
target: base_dev
image: base:dev
ports:
- "3000:3000"
entrypoint:
- gin
- -i
- run
- /src/server.go
env_file:
- .env
volumes:
- "./src:/src"
FROM golang:1.11 as base
ENV GOPATH "$GOPATH:/"
COPY ./src /src
WORKDIR /src
RUN go get github.com/gorilla/mux
RUN go get github.com/getsentry/raven-go
RUN go build server.go
FROM base AS base_dev
RUN go get github.com/codegangsta/gin
VOLUME /src
ENV PORT 3001
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment