File tree Expand file tree Collapse file tree 4 files changed +44
-20
lines changed
Expand file tree Collapse file tree 4 files changed +44
-20
lines changed Original file line number Diff line number Diff line change 11# golang image where workspace (GOPATH) configured at /go.
2- FROM golang:1.11.2
2+ FROM golang:1.11.2 as dev
33
44# Install dependencies
55RUN go get gopkg.in/mgo.v2
@@ -11,11 +11,17 @@ ADD . /go/src/github.com/mmorejon/cinema/bookings
1111# Setting up working directory
1212WORKDIR /go/src/github.com/mmorejon/cinema/bookings
1313
14- # Build the bookings command inside the container.
15- RUN go install github.com/mmorejon/cinema/ bookings
14+ # build binary
15+ RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o bookings .
1616
17- # Run the bookings microservice when the container starts.
18- ENTRYPOINT /go/bin/bookings
1917
18+ # alpine image
19+ FROM alpine:3.9.2 as prod
20+ # Setting up working directory
21+ WORKDIR /root/
22+ # copy movies binary
23+ COPY --from=dev /go/src/github.com/mmorejon/cinema/bookings .
2024# Service listens on port 8080.
2125EXPOSE 8080
26+ # Run the movies microservice when the container starts.
27+ ENTRYPOINT ["./bookings" ]
Original file line number Diff line number Diff line change 11# golang image where workspace (GOPATH) configured at /go.
2- FROM golang:1.11.2
2+ FROM golang:1.11.2 as dev
33
44# Install dependencies
55RUN go get gopkg.in/mgo.v2
@@ -11,11 +11,17 @@ ADD . /go/src/github.com/mmorejon/cinema/movies
1111# Setting up working directory
1212WORKDIR /go/src/github.com/mmorejon/cinema/movies
1313
14- # Build the movies command inside the container.
15- RUN go install github.com/mmorejon/cinema/ movies
14+ # build binary
15+ RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o movies .
1616
17- # Run the movies microservice when the container starts.
18- ENTRYPOINT /go/bin/movies
1917
18+ # alpine image
19+ FROM alpine:3.9.2 as prod
20+ # Setting up working directory
21+ WORKDIR /root/
22+ # copy movies binary
23+ COPY --from=dev /go/src/github.com/mmorejon/cinema/movies .
2024# Service listens on port 8080.
2125EXPOSE 8080
26+ # Run the movies microservice when the container starts.
27+ ENTRYPOINT ["./movies" ]
Original file line number Diff line number Diff line change 11# golang image where workspace (GOPATH) configured at /go.
2- FROM golang:1.11.2
2+ FROM golang:1.11.2 as dev
33
44# Install dependencies
55RUN go get gopkg.in/mgo.v2
@@ -11,11 +11,17 @@ ADD . /go/src/github.com/mmorejon/cinema/showtimes
1111# Setting up working directory
1212WORKDIR /go/src/github.com/mmorejon/cinema/showtimes
1313
14- # Build the showtimes command inside the container.
15- RUN go install github.com/mmorejon/cinema/ showtimes
14+ # build binary
15+ RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o showtimes .
1616
17- # Run the showtimes microservices when the container starts.
18- ENTRYPOINT /go/bin/showtimes
1917
18+ # alpine image
19+ FROM alpine:3.9.2 as prod
20+ # Setting up working directory
21+ WORKDIR /root/
22+ # copy movies binary
23+ COPY --from=dev /go/src/github.com/mmorejon/cinema/showtimes .
2024# Service listens on port 8080.
2125EXPOSE 8080
26+ # Run the movies microservice when the container starts.
27+ ENTRYPOINT ["./showtimes" ]
Original file line number Diff line number Diff line change 11# golang image where workspace (GOPATH) configured at /go.
2- FROM golang:1.11.2
2+ FROM golang:1.11.2 as dev
33
44# Install dependencies
55RUN go get gopkg.in/mgo.v2
@@ -11,11 +11,17 @@ ADD . /go/src/github.com/mmorejon/cinema/users
1111# Setting up working directory
1212WORKDIR /go/src/github.com/mmorejon/cinema/users
1313
14- # Build the users command inside the container.
15- RUN go install github.com/mmorejon/cinema/ users
14+ # build binary
15+ RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o users .
1616
17- # Run the users microservice when the container starts.
18- ENTRYPOINT /go/bin/users
1917
18+ # alpine image
19+ FROM alpine:3.9.2 as prod
20+ # Setting up working directory
21+ WORKDIR /root/
22+ # copy movies binary
23+ COPY --from=dev /go/src/github.com/mmorejon/cinema/users .
2024# Service listens on port 8080.
2125EXPOSE 8080
26+ # Run the movies microservice when the container starts.
27+ ENTRYPOINT ["./users" ]
You can’t perform that action at this time.
0 commit comments