add
This commit is contained in:
@@ -72,8 +72,15 @@ func SetupTimezone(tz string) error {
|
|||||||
}
|
}
|
||||||
loc, err := time.LoadLocation(tz)
|
loc, err := time.LoadLocation(tz)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
// fallback for alpine without tzdata
|
||||||
|
switch tz {
|
||||||
|
case "Asia/Shanghai", "PRC", "CST":
|
||||||
|
time.Local = time.FixedZone("CST", 8*3600)
|
||||||
|
return nil
|
||||||
|
default:
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
}
|
||||||
time.Local = loc
|
time.Local = loc
|
||||||
return nil
|
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
|
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /workspace/bin/country-service ./services/country
|
||||||
|
|
||||||
FROM alpine:3.19
|
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
|
USER app
|
||||||
COPY --from=builder /workspace/bin/country-service /usr/local/bin/country-service
|
COPY --from=builder /workspace/bin/country-service /usr/local/bin/country-service
|
||||||
EXPOSE 8081
|
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
|
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /workspace/bin/user-service ./services/user
|
||||||
|
|
||||||
FROM alpine:3.19
|
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
|
USER app
|
||||||
COPY --from=builder /workspace/bin/user-service /usr/local/bin/user-service
|
COPY --from=builder /workspace/bin/user-service /usr/local/bin/user-service
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|||||||
Reference in New Issue
Block a user