# Copy whole project's contents(not entire folder) into .(/goapp/) and build Golang
FROM golang:alpine as serverbuilder
ENV GO111MODULE=on \
    CGO_ENABLED=0 \
    GOOS=linux \
    GOPROXY=https://goproxy.cn,direct \
    GOARCH=amd64

WORKDIR /goapp
COPY . .

RUN apk --no-cache update && \
	apk add --update vim && \
	apk --no-cache add py-pip py-setuptools ca-certificates bash curl

RUN python3 -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
RUN pip --no-cache-dir install awscli

RUN go mod tidy && go build -o ./bin/devtier-billing ./cmd/billing/*.go && \
	rm -rf /var/cache/apk/*

# Set the image's default run command
CMD ["/goapp/bin/devtier-billing"]
