mirror of
https://github.com/sstent/containers.git
synced 2025-12-06 08:01:51 +00:00
31 lines
609 B
Docker
31 lines
609 B
Docker
# STEP 1 build executable binary
|
|
FROM golang:1.14-alpine as builder
|
|
|
|
WORKDIR $GOPATH/src/github.com/asciimoo/morty
|
|
|
|
RUN apk add --no-cache git
|
|
|
|
COPY . .
|
|
RUN go get -d -v
|
|
RUN gofmt -l ./
|
|
#RUN go vet -v ./...
|
|
#RUN go test -v ./...
|
|
RUN go build .
|
|
|
|
# STEP 2 build the image including only the binary
|
|
FROM alpine:3.12
|
|
|
|
EXPOSE 3000
|
|
|
|
RUN apk --no-cache add ca-certificates \
|
|
&& rm -f /var/cache/apk/* \
|
|
&& adduser -D -h /usr/local/morty -s /bin/false morty morty
|
|
|
|
COPY --from=builder /go/src/github.com/asciimoo/morty/morty /usr/local/morty/morty
|
|
|
|
USER morty
|
|
|
|
ENV DEBUG=true
|
|
|
|
ENTRYPOINT ["/usr/local/morty/morty"]
|