1
0
mirror of https://github.com/eventials/goevents.git synced 2025-04-26 13:48:59 +08:00

Improved docker files

This commit is contained in:
Jonathan A. Schweder 2018-06-15 10:40:03 -03:00
parent 9692e82e24
commit cbecd945e3
2 changed files with 25 additions and 8 deletions

View File

@ -1,12 +1,28 @@
FROM golang:1.10 FROM golang:1.10
RUN apt-get update && apt-get install -y wget ARG PLATFORM=linux
RUN wget https://github.com/jwilder/dockerize/releases/download/v0.2.0/dockerize-linux-amd64-v0.2.0.tar.gz ENV PLATFORM $PLATFORM_VERSION
RUN tar -C /usr/local/bin -xzvf dockerize-linux-amd64-v0.2.0.tar.gz
ARG ARCH=amd64
ENV ARCH $ARCH_VERSION
ARG DOCKERIZE_VERSION=v0.2.0
ENV DOCKERIZE_VERSION $DOCKERIZE_VERSION
ADD https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-$PLATFORM-$ARCH-$DOCKERIZE_VERSION.tar.gz /usr/local/bin
RUN cd /usr/local/bin \
&& tar -xzf ./dockerize-$PLATFORM-$ARCH-$DOCKERIZE_VERSION.tar.gz \
&& rm -f ./dockerize-$PLATFORM-$ARCH-$DOCKERIZE_VERSION.tar.gz
RUN mkdir -p /go/src/github.com/eventials/goevents RUN mkdir -p /go/src/github.com/eventials/goevents
WORKDIR /go/src/github.com/eventials/goevents WORKDIR /go/src/github.com/eventials/goevents
RUN go get github.com/streadway/amqp RUN go get \
RUN go get github.com/sirupsen/logrus github.com/streadway/amqp \
RUN go get github.com/stretchr/testify github.com/sirupsen/logrus \
github.com/stretchr/testify
ENTRYPOINT ["dockerize"]
CMD ["-wait", "tcp://broker:5672", "-timeout", "60s", "go", "run", "examples/consumer/consumer.go"]

View File

@ -2,12 +2,13 @@ version: '2'
services: services:
app: app:
build: . build: .
working_dir: /go/src/github.com/eventials/goevents
command: dockerize -wait tcp://broker:5672 -timeout 60s go run examples/consumer/consumer.go
links: links:
- broker - broker
depends_on:
- broker
volumes: volumes:
- .:/go/src/github.com/eventials/goevents - .:/go/src/github.com/eventials/goevents
broker: broker:
image: rabbitmq:3.6-management image: rabbitmq:3.6-management
ports: ports: