Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Reduced proxy image size to save on data transfer costs

Michal Rutka1227e8b2c480
diff --git a/docker-compose-swarm.yml b/docker-compose-swarm.yml
index 7c78f99c0..0be3f9e6d 100644
--- a/docker-compose-swarm.yml
+++ b/docker-compose-swarm.yml
@@ -36,6 +36,7 @@ networks:
volumes:
proxy-data:
deployment-data:
+ keycloak-data:
postgresql-data:
services:
@@ -54,7 +55,7 @@ services:
# Enable --staging will manage fake certificates, so avoid hitting the rate limits of Let's Encrypt
# when testing (this is important, you are limited to 5 duplicate certificates per week!)
- # LE_EXTRA_ARGS: '--staging --logs-dir=/etc/letsencrypt'
+ LE_EXTRA_ARGS: '--staging --logs-dir=/etc/letsencrypt'
# Traffic should be forwarded to this service (defaults to manager:8080)
# PROXY_BACKEND_HOST: manager
@@ -91,15 +92,12 @@ services:
# configuration files which were baked into the managers image.
manager:
- # Image will be pulled when using the `docker-compose pull` command or `docker-compose up --no-build`
image: openremote/manager:${DATE_TAG:-swarm}
networks:
- private
environment:
- # It is important that all services have the same timezone and are time synchronized.
- # Bearer tokens are only valid for minutes, and authentication fails if Keycloak drifts.
TZ: Europe/Amsterdam
# If developer mode is enabled, all setup tasks will be executed on application startup.
@@ -232,7 +230,7 @@ services:
- "8081:8080"
volumes:
- - deployment-data:/deployment
+ - keycloak-data:/deployment
# This configuration stores postgresql data in a Docker volume. You manage this volume
# independently from your stack with with 'docker volume ls', 'docker volume rm', etc.
diff --git a/proxy/Dockerfile b/proxy/Dockerfile
index 778685f0a..1364473c4 100644
--- a/proxy/Dockerfile
+++ b/proxy/Dockerfile
@@ -1,4 +1,4 @@
-FROM debian:stretch
+FROM debian:stretch AS builder
MAINTAINER [email protected]
# Install utilities
@@ -23,12 +23,6 @@ ARG LUA_VERSION=5.3.4
ARG ACME_PLUGIN_VERSION=0.1.1
ARG DOMAINNAME
ARG LOCAL_CERT_FILE
-ENV DOMAINNAME=${DOMAINNAME:-localhost}
-ENV LOCAL_CERT_FILE=$LOCAL_CERT_FILE
-ENV TERM xterm
-ENV PROXY_LOGLEVEL notice
-ENV PROXY_BACKEND_HOST=${PROXY_BACKEND_HOST:-manager}
-ENV PROXY_BACKEND_PORT=${PROXY_BACKEND_PORT:-8080}
RUN mkdir /tmp/lua && cd /tmp/lua \
&& curl -sSL https://www.lua.org/ftp/lua-${LUA_VERSION}.tar.gz -o lua.tar.gz \
@@ -58,11 +52,22 @@ ADD selfsigned /opt/selfsigned
ADD cli.ini /root/.config/letsencrypt/
+COPY entrypoint.sh /
+RUN chmod +x /entrypoint.sh
+
+FROM scratch
+
+ENV DOMAINNAME=${DOMAINNAME:-localhost}
+ENV LOCAL_CERT_FILE=$LOCAL_CERT_FILE
+ENV TERM xterm
+ENV PROXY_LOGLEVEL notice
+ENV PROXY_BACKEND_HOST=${PROXY_BACKEND_HOST:-manager}
+ENV PROXY_BACKEND_PORT=${PROXY_BACKEND_PORT:-8080}
+
+COPY --from=builder / /
EXPOSE 80 443
HEALTHCHECK --interval=3s --timeout=3s --start-period=2s --retries=30 CMD curl --fail --silent http://localhost:80 || exit 1
-COPY entrypoint.sh /
-RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
-CMD ["run"]
\ No newline at end of file
+CMD ["run"]