新增index服务 docker
This commit is contained in:
parent
9fd6f70630
commit
f649d32c19
35
apps/index/Dockerfile
Normal file
35
apps/index/Dockerfile
Normal file
@ -0,0 +1,35 @@
|
||||
FROM golang:alpine AS builder
|
||||
|
||||
LABEL stage=gobuilder
|
||||
|
||||
ENV CGO_ENABLED 0
|
||||
ENV GOPROXY https://goproxy.cn,direct
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
|
||||
|
||||
RUN apk update --no-cache && apk add --no-cache tzdata
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
RUN mkdir -p /tmp && chmod 1777 /tmp
|
||||
|
||||
ADD go.mod .
|
||||
ADD go.sum .
|
||||
RUN go mod download
|
||||
COPY . .
|
||||
COPY apps/index/etc /app/etc
|
||||
RUN go build -ldflags="-s -w" -o /app/index apps/index/index.go
|
||||
|
||||
|
||||
FROM scratch
|
||||
|
||||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
||||
COPY --from=builder /usr/share/zoneinfo/Asia/Shanghai /usr/share/zoneinfo/Asia/Shanghai
|
||||
ENV TZ Asia/Shanghai
|
||||
|
||||
COPY --from=builder /tmp /tmp
|
||||
|
||||
WORKDIR /app
|
||||
COPY --from=builder /app/index /app/index
|
||||
COPY --from=builder /app/etc /app/etc
|
||||
|
||||
CMD ["./index", "-f", "etc/index-api.yaml"]
|
@ -128,6 +128,22 @@ services:
|
||||
- tyapi_network
|
||||
restart: always
|
||||
|
||||
tyapi_index:
|
||||
container_name: tyapi_index
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./apps/index/Dockerfile
|
||||
ports:
|
||||
- "10004:10004"
|
||||
environment:
|
||||
- ENV=production
|
||||
depends_on:
|
||||
- tyapi_etcd
|
||||
- tyapi_sentinel
|
||||
networks:
|
||||
- tyapi_network
|
||||
restart: always
|
||||
|
||||
tyapi_mqs:
|
||||
container_name: tyapi_mqs
|
||||
build:
|
||||
|
Loading…
Reference in New Issue
Block a user