From 4f6689f1400abaabd765638c925c6d9e49df19a3 Mon Sep 17 00:00:00 2001 From: Manuel Stahl Date: Wed, 24 Apr 2024 15:29:06 +0200 Subject: [PATCH 1/2] Add BUILDKIT_CONTEXT_KEEP_GIT_DIR=1 to README and docker-compose.yml Fixes #513, #516. Change-Id: I18d67a53db51cab622b315f153a106fda153476b --- README.md | 3 ++- docker-compose.yml | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5c144b52..3c443732 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,8 @@ You have three options: hostname: synapse-admin build: context: https://github.com/Awesome-Technologies/synapse-admin.git - # args: + args: + - BUILDKIT_CONTEXT_KEEP_GIT_DIR=1 # - NODE_OPTIONS="--max_old_space_size=1024" ports: - "8080:80" diff --git a/docker-compose.yml b/docker-compose.yml index e7b91ce7..f97db80c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,6 +11,7 @@ services: # context: https://github.com/Awesome-Technologies/synapse-admin.git # args: + # - BUILDKIT_CONTEXT_KEEP_GIT_DIR=1 # if you're building on an architecture other than amd64, make sure # to define a maximum ram for node. otherwise the build will fail. # - NODE_OPTIONS="--max_old_space_size=1024" From a74a37a2694b1f9c192aa2a32c26e163ea137fba Mon Sep 17 00:00:00 2001 From: Manuel Stahl Date: Wed, 24 Apr 2024 16:00:55 +0200 Subject: [PATCH 2/2] Add BASE_PATH argument to Dockerfile Fixes #512, #517. Change-Id: I0367f681aaf35af4a0f1b324fb0bdbef272e6db4 --- .dockerignore | 2 ++ Dockerfile | 4 +++- README.md | 18 +++++++++++------- docker-compose.yml | 11 ++++++----- 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/.dockerignore b/.dockerignore index dbd5eff8..8f356df9 100644 --- a/.dockerignore +++ b/.dockerignore @@ -6,6 +6,8 @@ lib/ node_modules/ electron_app/ karma-reports/ +.pnp.cjs +.pnp.loader.mjs .idea/ .tmp/ config.json* diff --git a/Dockerfile b/Dockerfile index aa529b52..70650b0b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,8 @@ # Builder FROM node:lts as builder LABEL org.opencontainers.image.url=https://github.com/Awesome-Technologies/synapse-admin org.opencontainers.image.source=https://github.com/Awesome-Technologies/synapse-admin +# Base path for synapse admin +ARG BASE_PATH=./ WORKDIR /src @@ -13,7 +15,7 @@ COPY package.json .yarnrc.yml yarn.lock ./ RUN yarn config set enableTelemetry 0 && yarn install --immutable --network-timeout=300000 COPY . /src -RUN yarn build +RUN yarn build --base=$BASE_PATH # App FROM nginx:stable-alpine diff --git a/README.md b/README.md index 3c443732..122a3130 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,7 @@ You have three options: args: - BUILDKIT_CONTEXT_KEEP_GIT_DIR=1 # - NODE_OPTIONS="--max_old_space_size=1024" + # - BASE_PATH="/synapse-admin" ports: - "8080:80" restart: unless-stopped @@ -123,7 +124,13 @@ services: ### Serving Synapse-Admin on a different path -We do not support directly changing the path where Synapse-Admin is served. Instead please use a reverse proxy if you need to move Synapse-Admin to a different base path. If you want to serve multiple applications with different paths on the same domain, you need a reverse proxy anyway. +The path prefix where synapse-admin is served can only be changed during the build step. + +If you downloaded the source code, use `yarn build --base=/my-prefix` to set a path prefix. + +If you want to build your own Docker container, use the `BASE_PATH` argument. + +We do not support directly changing the path where Synapse-Admin is served in the pre-built Docker container. Instead please use a reverse proxy if you need to move Synapse-Admin to a different base path. If you want to serve multiple applications with different paths on the same domain, you need a reverse proxy anyway. Example for Traefik: @@ -139,20 +146,17 @@ services: - 443:443 volumes: - /var/run/docker.sock:/var/run/docker.sock:ro - labels: - - "traefik.http.middlewares.admin.redirectregex.regex:^(.*)/admin/?" - - "traefik.http.middlewares.admin.redirectregex.replacement:$${1}/admin/" - - "traefik.http.middlewares.admin_path.replacepathregex.regex:^/admin/(.*)" - - "traefik.http.middlewares.admin_path.replacepathregex.replacement:/$1" synapse-admin: image: awesometechnologies/synapse-admin:latest restart: unless-stopped labels: - "traefik.enable=true" - - "traefik.http.routers.synapse-admin.priority=3" - "traefik.http.routers.synapse-admin.rule=Host(`example.com`)&&PathPrefix(`/admin`)" - "traefik.http.routers.synapse-admin.middlewares=admin,admin_path" + - "traefik.http.middlewares.admin.redirectregex.regex=^(.*)/admin/?" + - "traefik.http.middlewares.admin.redirectregex.replacement=$${1}/admin/" + - "traefik.http.middlewares.admin_path.stripprefix.prefixes=/admin" ``` ## Screenshots diff --git a/docker-compose.yml b/docker-compose.yml index f97db80c..e599a2f5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,11 +10,12 @@ services: # replace the context definition with this: # context: https://github.com/Awesome-Technologies/synapse-admin.git - # args: - # - BUILDKIT_CONTEXT_KEEP_GIT_DIR=1 - # if you're building on an architecture other than amd64, make sure - # to define a maximum ram for node. otherwise the build will fail. - # - NODE_OPTIONS="--max_old_space_size=1024" + # args: + # - BUILDKIT_CONTEXT_KEEP_GIT_DIR=1 + # if you're building on an architecture other than amd64, make sure + # to define a maximum ram for node. otherwise the build will fail. + # - NODE_OPTIONS="--max_old_space_size=1024" + # - BASE_PATH="/synapse-admin" ports: - "8080:80" restart: unless-stopped