Skip to content

Instantly share code, notes, and snippets.

@mattgen88
Created October 8, 2019 03:45
Show Gist options
  • Save mattgen88/7788fb592f3cc02d45e718707ff75db1 to your computer and use it in GitHub Desktop.
Save mattgen88/7788fb592f3cc02d45e718707ff75db1 to your computer and use it in GitHub Desktop.
Dockerfile that automatically recompiles go application and then runs it on success
FROM golang:alpine as builder
RUN apk update && apk upgrade && \
apk add --no-cache bash git openssh
RUN mkdir /build
WORKDIR /build/
COPY . /build/
RUN go get
RUN go get github.com/githubnemo/CompileDaemon
CMD ["CompileDaemon", "-build=go build -o app", "-directory=/build", "-command=/build/app"]
EXPOSE 8000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment