-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
28 lines (23 loc) · 984 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
FROM golang:1.17-alpine AS builder
WORKDIR /app
COPY . .
ENV GOPROXY=https://goproxy.cn
RUN CGO_ENABLED=1 go build -o /wutong-gateway cmd/gateway.go
FROM wutongpaas/openresty:1.19.3.2-alpine
ARG TARGETARCH
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && apk add --no-cache bash net-tools curl tzdata && \
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo "Asia/Shanghai" > /etc/timezone && \
date && apk del --no-cache tzdata
COPY ./hack/ /run/
RUN set -eux; \
if [ "${TARGETARCH}" = "arm64" ]; then \
wget https://wutong-paas.obs.cn-east-3.myhuaweicloud.com/arm/librestychash.so -O /run/nginx/lua/vendor/so/librestychash.so; \
fi
COPY --from=builder /wutong-gateway /wutong-gateway
ENV NGINX_CONFIG_TMPL=/run/nginxtmp
ENV NGINX_CUSTOM_CONFIG=/run/nginx/conf
ENV OPENRESTY_HOME=/usr/local/openresty
ENV PATH="${PATH}:${OPENRESTY_HOME}/nginx/sbin"
EXPOSE 8080
ENTRYPOINT ["/wutong-gateway"]