From 39f3da3a82dd28fc336bd7de6847877cc3221a1d Mon Sep 17 00:00:00 2001 From: "Jonathan Leibiusky (@xetorthio)" Date: Thu, 10 Nov 2016 15:30:40 -0300 Subject: [PATCH] Add docker files --- Dockerfile | 19 +++++++++++++++++++ Dockerfile.run | 11 +++++++++++ build.sh | 3 +++ 3 files changed, 33 insertions(+) create mode 100644 Dockerfile create mode 100644 Dockerfile.run create mode 100755 build.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4a25c9c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM golang:1.7.1 + +# Copy the runtime dockerfile into the context as Dockerfile +COPY Dockerfile.run /go/bin/Dockerfile +COPY ./www /go/bin/www + +COPY . /go/src/github.com/franela/play-with-docker + +WORKDIR /go/src/github.com/franela/play-with-docker + +RUN go get -v -d ./... + +RUN CGO_ENABLED=0 go build -a -installsuffix nocgo -o /go/bin/play-with-docker . + +# Set the workdir to be /go/bin which is where the binaries are built +WORKDIR /go/bin + +# Export the WORKDIR as a tar stream +CMD tar -cf - . diff --git a/Dockerfile.run b/Dockerfile.run new file mode 100644 index 0000000..fb43123 --- /dev/null +++ b/Dockerfile.run @@ -0,0 +1,11 @@ +FROM alpine + +RUN apk --update add ca-certificates + +ADD play-with-docker /bin/play-with-docker +COPY ./www /bin/www + +WORKDIR /bin +CMD ["play-with-docker"] + +EXPOSE 3000 diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..4e72fe1 --- /dev/null +++ b/build.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +docker build -t builder .&& docker run --rm builder | sudo docker build -t franela/play-with-docker:master -