mirror of
https://github.com/umputun/reproxy.git
synced 2025-06-30 22:13:42 +02:00
support TZ customization
This commit is contained in:
11
Dockerfile
11
Dockerfile
@ -13,7 +13,7 @@ WORKDIR /build
|
||||
RUN apk add -u git
|
||||
RUN \
|
||||
if [ -z "$CI" ] ; then \
|
||||
echo "runs outside of CI" && version=$(git log -1 --format=%h)-$(date +%Y%m%dT%H:%M:%S); \
|
||||
echo "runs outside of CI" && version=$(git rev-parse --abbrev-ref HEAD)-$(git log -1 --format=%h)-$(date +%Y%m%dT%H:%M:%S); \
|
||||
else version=${GIT_BRANCH}-${GITHUB_SHA:0:7}-$(date +%Y%m%dT%H:%M:%S); fi && \
|
||||
echo "version=$version" && \
|
||||
cd app && go build -o /build/reproxy -ldflags "-X main.revision=${version} -s -w"
|
||||
@ -23,17 +23,20 @@ FROM alpine:3.13
|
||||
|
||||
ENV \
|
||||
TERM=xterm-color \
|
||||
TIME_ZONE=America/Chicago
|
||||
TIME_ZONE=UTC
|
||||
|
||||
RUN \
|
||||
apk add --no-cache --update tzdata curl ca-certificates && \
|
||||
apk add --no-cache --update tzdata curl ca-certificates dumb-init && \
|
||||
cp /usr/share/zoneinfo/${TIME_ZONE} /etc/localtime && \
|
||||
echo "${TIME_ZONE}" > /etc/timezone && date && \
|
||||
ln -s /usr/bin/dumb-init /sbin/dinit && \
|
||||
rm -rf /var/cache/apk/*
|
||||
|
||||
COPY init.sh /init.sh
|
||||
COPY --from=backend /build/reproxy /srv/reproxy
|
||||
RUN chmod +x /srv/reproxy
|
||||
LABEL reproxy.enabled="false"
|
||||
WORKDIR /srv
|
||||
|
||||
ENTRYPOINT ["/srv/reproxy"]
|
||||
ENTRYPOINT ["/init.sh"]
|
||||
CMD ["/srv/reproxy"]
|
@ -13,6 +13,7 @@ services:
|
||||
- DOCKER_ENABLED=true
|
||||
- ASSETS_LOCATION=/web
|
||||
- DEBUG=true
|
||||
- TIME_ZONE=America/Chicago
|
||||
|
||||
svc1:
|
||||
image: hashicorp/http-echo
|
||||
|
15
init.sh
Executable file
15
init.sh
Executable file
@ -0,0 +1,15 @@
|
||||
#!/sbin/dinit /bin/sh
|
||||
|
||||
uid=$(id -u)
|
||||
|
||||
if [[ ${uid} -eq 0 ]]; then
|
||||
echo "init container"
|
||||
|
||||
# set container's time zone
|
||||
cp /usr/share/zoneinfo/${TIME_ZONE} /etc/localtime
|
||||
echo "${TIME_ZONE}" >/etc/timezone
|
||||
echo "set timezone ${TIME_ZONE} ($(date))"
|
||||
fi
|
||||
|
||||
echo "execute \"$@\""
|
||||
exec $@
|
Reference in New Issue
Block a user