################################################################################
##                               MAIN STAGE                                   ##
################################################################################
# Copy the manager into the distroless image.
#FROM scratch
#FROM hub.sre.ink/base/distroless-static:nonroot-20210710
#FROM mirror.ccs.tencentyun.com/library/alpine:3.13
FROM alpine:3.15.0
#FROM hub.sre.ink/base/alpine:3.15.0
#FROM centos:7.9.2009
LABEL Description="sre ip region service"
MAINTAINER sre <sre@yangqiao.org>
#RUN echo 'https://mirrors.cloud.tencent.com/alpine/v3.13/main' > /etc/apk/repositories \
#    && echo 'https://mirrors.cloud.tencent.com/alpine/v3.13/community' >>/etc/apk/repositories \
#    && apk update && apk add tzdata && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
#    && echo "Asia/Shanghai" > /etc/timezone
RUN apk update && apk add tzdata && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
    && echo "Asia/Shanghai" > /etc/timezone

WORKDIR /app
ADD ipregion.bin /app/ipregion.bin
COPY ip2region.db /app/ip2region.db
RUN chmod -R 777 /app

#USER nonroot:nonroot
EXPOSE 8080
ENTRYPOINT ["/app/ipregion.bin"]