Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions backend/manageApiService/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
FROM golang:1.22-alpine AS builder

WORKDIR /build

ARG proxy=https://proxy.golang.org
ENV proxy=$proxy
RUN echo "proxy: $proxy"

ENV GOPROXY=${proxy}

COPY go.mod .
RUN go mod download

COPY . .
RUN CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build -ldflags "-X google.golang.org/protobuf/reflect/protoregistry.conflictPolicy=warn" -a -o serve ./cmd/

FROM golang:1.22-alpine AS promtail-builder

WORKDIR /build

ARG proxy=https://proxy.golang.org
ENV proxy=$proxy
RUN echo "proxy: $proxy"

ENV GOPROXY=${proxy}

RUN wget https://github.com/grafana/loki/archive/refs/tags/v3.1.1.zip
RUN unzip v3.1.1.zip

WORKDIR /build/loki-3.1.1

RUN go mod download
RUN CGO_ENABLED=0 go build ./clients/cmd/promtail

FROM alpine:3.16 AS runner

WORKDIR /app

RUN mkdir tmp
RUN mkdir logs
RUN mkdir configs

COPY --from=builder /build/serve /app/serve
COPY ./configs /app/configs
COPY ./entrypoint.sh /app/entrypoint.sh
COPY ./promtail.yaml /app/promtail.yaml

COPY --from=promtail-builder /build/loki-3.1.1/promtail /app/promtail

RUN wget https://dl.min.io/client/mc/release/linux-amd64/mc
RUN chmod -R 777 mc

ENTRYPOINT ["./entrypoint.sh"]
20 changes: 20 additions & 0 deletions backend/manageApiService/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
install:
go install github.com/favadi/protoc-go-inject-tag@latest
go install github.com/cloudzenith/DouTok/backend/gopkgs/tools/protoc-gen-go-http@latest
go install github.com/cloudzenith/DouTok/backend/gopkgs/tools/protoc-gen-openapi@latest

gen-proto:
protoc \
--proto_path=./api \
--proto_path=./third_party \
--go_out=paths=source_relative:./api \
--go-http_out=paths=source_relative:./api \
--openapi_out=fq_schema_naming=true,default_response=false:. \
./api/msapi/*.proto
protoc-go-inject-tag -input="./api/msapi/*.pb.go"

build:
docker build -t manage-api-service .

build1:
docker build --build-arg proxy="https://goproxy.cn" -t base-service .
Loading
Loading