Introdução

Instalação

Exemplo de Dockerfile

# Dockerfile
FROM golang:1.15
WORKDIR /go/src
ENV PATH="/go/bin:${PATH}"
ENV GO111MODULE=on
ENV CGO_ENABLED=1
RUN apt-get update && \
apt-get install build-essential protobuf-compiler librdkafka-dev -y && \
go get google.golang.org/grpc/cmd/protoc-gen-go-grpc && \
go get google.golang.org/protobuf/cmd/protoc-gen-go && \
go get github.com/spf13/cobra/cobra && \
wget https://github.com/ktr0731/evans/releases/download/0.9.1/evans_linux_amd64.tar.gz && \
tar -xzvf evans_linux_amd64.tar.gz && \
mv evans ../bin && rm -f evans_linux_amd64.tar.gz
CMD ["tail", "-f", "/dev/null"]

Exemplo de Docker Compose

# docker-compose.yml
version: "3"
services:
app:
build: .
volumes:
- .:/go/src/

Iniciando na máquina do Docker

# Executar as instâncias
docker-compose up -d
# Acessar a máquina
docker exec -it NOMEDAAPLICACAO bash
# Iniciar as instâncias do Go
go mod init github.com/codeedu/imersao/codepix-go