build(oci):加入容器化打包支持。

This commit is contained in:
徐涛 2022-08-13 08:37:28 +08:00
parent e1aa45a1d7
commit 64ee9692fe
2 changed files with 23 additions and 6 deletions

17
Dockerfile Normal file
View File

@ -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"]

View File

@ -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