add
This commit is contained in:
@@ -72,7 +72,14 @@ func SetupTimezone(tz string) error {
|
||||
}
|
||||
loc, err := time.LoadLocation(tz)
|
||||
if err != nil {
|
||||
return err
|
||||
// fallback for alpine without tzdata
|
||||
switch tz {
|
||||
case "Asia/Shanghai", "PRC", "CST":
|
||||
time.Local = time.FixedZone("CST", 8*3600)
|
||||
return nil
|
||||
default:
|
||||
return err
|
||||
}
|
||||
}
|
||||
time.Local = loc
|
||||
return nil
|
||||
|
||||
@@ -12,7 +12,8 @@ RUN cd services/country && go mod download
|
||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /workspace/bin/country-service ./services/country
|
||||
|
||||
FROM alpine:3.19
|
||||
RUN adduser -D -u 10002 app
|
||||
RUN apk add --no-cache tzdata && adduser -D -u 10002 app
|
||||
ENV TZ=Asia/Shanghai
|
||||
USER app
|
||||
COPY --from=builder /workspace/bin/country-service /usr/local/bin/country-service
|
||||
EXPOSE 8081
|
||||
|
||||
@@ -12,7 +12,8 @@ RUN cd services/user && go mod download
|
||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /workspace/bin/user-service ./services/user
|
||||
|
||||
FROM alpine:3.19
|
||||
RUN adduser -D -u 10001 app
|
||||
RUN apk add --no-cache tzdata && adduser -D -u 10001 app
|
||||
ENV TZ=Asia/Shanghai
|
||||
USER app
|
||||
COPY --from=builder /workspace/bin/user-service /usr/local/bin/user-service
|
||||
EXPOSE 8080
|
||||
|
||||
Reference in New Issue
Block a user