# Build MetaCryptor in a stock Go builder container
FROM golang:alpine as builder
RUN apk add --no-cache make git gcc musl-dev linux-headers

ADD . /code
ENV GO111MODULE off
RUN cd /code && make metacryptor

FROM alpine:latest
RUN echo "https://mirror.tuna.tsinghua.edu.cn/alpine/v3.4/main/" > /etc/apk/repositories

RUN apk update \
        && apk upgrade \
        && apk add --no-cache bash \
        bash-doc \
        bash-completion \
        && rm -rf /var/cache/apk/* \
        && /bin/bash
RUN apk add --no-cache ca-certificates
COPY --from=builder /code/build/bin/metacryptor /usr/local/bin/
EXPOSE 38001
ENTRYPOINT ["metacryptor"]
