Created
February 27, 2019 14:22
-
-
Save filipecifali/00a524cb9167f1d4be7daf0e92495ec3 to your computer and use it in GitHub Desktop.
Docker for go dev and prod
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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