1
0
mirror of https://github.com/umputun/reproxy.git synced 2025-07-06 22:15:41 +02:00

switch final image to scratch base

This commit is contained in:
Umputun
2021-04-14 03:26:20 -05:00
parent da7a860706
commit ab0f5c0e1d
6 changed files with 13 additions and 32 deletions

View File

@ -10,7 +10,8 @@ ENV CGO_ENABLED=0
ADD . /build ADD . /build
WORKDIR /build WORKDIR /build
RUN apk add -u git RUN apk add --no-cache --update git tzdata ca-certificates
RUN \ RUN \
if [ -z "$CI" ] ; then \ if [ -z "$CI" ] ; then \
echo "runs outside of CI" && version=$(git rev-parse --abbrev-ref HEAD)-$(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); \
@ -19,23 +20,11 @@ RUN \
cd app && go build -o /build/reproxy -ldflags "-X main.revision=${version} -s -w" cd app && go build -o /build/reproxy -ldflags "-X main.revision=${version} -s -w"
FROM alpine:3.13 FROM scratch
ENV \ COPY --from=backend /usr/share/zoneinfo /usr/share/zoneinfo
TERM=xterm-color \ COPY --from=backend /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
TIME_ZONE=UTC
RUN \
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 COPY --from=backend /build/reproxy /srv/reproxy
RUN chmod +x /srv/reproxy
WORKDIR /srv
ENTRYPOINT ["/init.sh"] WORKDIR /srv
CMD ["/srv/reproxy"] ENTRYPOINT ["/srv/reproxy"]

View File

@ -1,5 +1,5 @@
FROM umputun/reproxy:master FROM umputun/reproxy:master
ENV TIME_ZONE=America/Chicago ENV TZ=America/Chicago
COPY assets /web COPY assets /web
EXPOSE 80 EXPOSE 80
CMD ["/srv/reproxy", "--assets.location=/web", "--listen=0.0.0.0:80"] CMD ["--assets.location=/web", "--listen=0.0.0.0:80"]

View File

@ -5,6 +5,3 @@ services:
hostname: reproxy-embed hostname: reproxy-embed
ports: ports:
- "80:80" - "80:80"
environment:
- LISTEN=0.0.0.0:8080
- ASSETS_LOCATION=/web

View File

@ -1,4 +1,4 @@
FROM umputun/reproxy:master FROM umputun/reproxy:master
ENV TIME_ZONE=America/Chicago ENV TIME_ZONE=America/Chicago
EXPOSE 80 EXPOSE 80
CMD ["/srv/reproxy", "--assets.location=/web", "--listen=0.0.0.0:80"] CMD ["--assets.location=/web", "--listen=0.0.0.0:80"]

View File

@ -7,6 +7,3 @@ services:
- "80:80" - "80:80"
volumes: volumes:
- ./assets:/web - ./assets:/web
environment:
- LISTEN=0.0.0.0:8080
- ASSETS_LOCATION=/web

View File

@ -3,20 +3,18 @@ services:
image: umputun/reproxy:master image: umputun/reproxy:master
container_name: reproxy container_name: reproxy
hostname: reproxy hostname: reproxy
labels:
reproxy.enabled: "false" # don't include reproxy to automatic destinations
ports: ports:
- "80:8080" - "80:8080"
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock - /var/run/docker.sock:/var/run/docker.sock:ro
- ./web:/web - ./web:/web
environment: environment:
- TZ=America/Chicago
- LISTEN=0.0.0.0:8080 - LISTEN=0.0.0.0:8080
- DOCKER_ENABLED=true - DOCKER_ENABLED=true
- DOCKER_AUTO=true - DOCKER_AUTO=true
- ASSETS_LOCATION=/web - ASSETS_LOCATION=/web
- DEBUG=true - DEBUG=true
- TIME_ZONE=America/Chicago
# automatic destination, will be mapped for ^/api/svc1/(.*) # automatic destination, will be mapped for ^/api/svc1/(.*)
svc1: svc1: