From 64ee9692fea7e5c8ee0085279878bbfc286d8829 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=B6=9B?= Date: Sat, 13 Aug 2022 08:37:28 +0800 Subject: [PATCH] =?UTF-8?q?build(oci):=E5=8A=A0=E5=85=A5=E5=AE=B9=E5=99=A8?= =?UTF-8?q?=E5=8C=96=E6=89=93=E5=8C=85=E6=94=AF=E6=8C=81=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 17 +++++++++++++++++ settings.yaml | 12 ++++++------ 2 files changed, 23 insertions(+), 6 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f758324 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM golang:1.19-alpine AS builder + +ENV GO111MODULE=on +ENV GOPROXY="https://goproxy.io" +RUN mkdir /app +WORKDIR /app +COPY go.mod go.sum ./ +RUN go mod download && go mod verify +ADD . /app +RUN CGO_ENABLED=0 GOOS=linux go build -v -o server . + +FROM alpine:latest AS production +RUN mkdir /app +WORKDIR /app +COPY --from=builder /app/server . +COPY settings.yaml . +CMD ["./main"] \ No newline at end of file diff --git a/settings.yaml b/settings.yaml index 39eaa8f..d68ea41 100644 --- a/settings.yaml +++ b/settings.yaml @@ -1,21 +1,21 @@ Database: User: electricity - Pass: - Host: + Pass: nLgxPO5s8gK2tR0OL0Q + Host: postgres Port: 5432 DB: electricity MaxIdleConns: 10 MaxOpenConns: 30 Server: - RunMode: debug + RunMode: release HttpPort: 8000 ReadTimeout: 60 WriteTimeout: 60 Redis: - Host: + Host: redis Port: 6379 - Password: - DB: 2 + Password: TmFRS0w6BIrAPA1Raj + DB: 1 Service: MaxSessionLife: 2h ItemsPageSize: 20