Skip to content

Commit

Permalink
Dockerfile: tidying it up
Browse files Browse the repository at this point in the history
  • Loading branch information
nkprince007 committed May 24, 2018
1 parent 66752ec commit 8bc69a0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
19 changes: 11 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
# Stage - Build
FROM golang:alpine as build-env

LABEL MAINTAINER Naveen Kumar Sangi <naveenkumarsangi@protonmail.com>

RUN apk --no-cache add git
ENV SOURCE /go/src/gitlab.com/nkprince007/listen
RUN mkdir -p $SOURCE
ADD . $SOURCE
WORKDIR $SOURCE
RUN mkdir -p /go/src/gitlab.com/nkprince007/listen
ADD . /go/src/gitlab.com/nkprince007/listen
WORKDIR /go/src/gitlab.com/nkprince007/listen

RUN go get -v ./...
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app .
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-w -s' -o listen .


# Stage - Deploy
FROM alpine:latest

RUN apk --no-cache add ca-certificates
ENV SOURCE /go/src/gitlab.com/nkprince007/listen
WORKDIR /root/
COPY --from=build-env $SOURCE .
CMD ["./app"]
COPY --from=build-env /go/src/gitlab.com/nkprince007/listen .

CMD ["./listen"]
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ services:
- RABBITMQ_DEFAULT_PASS=password
listen:
# listen is the actual listener service
command: /bin/sh -c "sleep 5; ./app;"
image: registry.gitlab.com/nkprince007/listen:latest
command: /bin/sh -c "sleep 5; ./listen;"
image: registry.gitlab.com/nkprince007/listen:docker
ports:
- 80
environment:
Expand Down

0 comments on commit 8bc69a0

Please sign in to comment.