From 1bcc0ace5e4103bb848fc6a71528b048de5eec91 Mon Sep 17 00:00:00 2001 From: ShareVB Date: Wed, 1 Jan 2025 11:59:42 +0100 Subject: [PATCH] fix(Dockerfile): allow base url in build and explained in readme --- Dockerfile | 4 ++++ README.md | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/Dockerfile b/Dockerfile index 4c3fde23..e1011331 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,10 +8,14 @@ WORKDIR /app COPY package.json pnpm-lock.yaml ./ RUN npm install -g pnpm && pnpm i --frozen-lockfile COPY . . +ARG BASE_URL +ENV BASE_URL=${BASE_URL} RUN pnpm build # production stage FROM nginx:stable-alpine AS production-stage +ARG BASE_URL +ENV BASE_URL=${BASE_URL} COPY --from=build-stage /app/dist /usr/share/nginx/html COPY nginx.conf /etc/nginx/conf.d/default.conf EXPOSE 80 diff --git a/README.md b/README.md index b7dfecab..bca10436 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,14 @@ You can use my image in your docker-compose file if you want an update to date v Almost [all tools PR of it-tools](https://github.com/CorentinTh/it-tools/pulls). +## Build docker image for a subfolder + +According to https://github.com/CorentinTh/it-tools/pull/461#issuecomment-1602506049: +``` +docker build -t it-tools --build-arg BASE_URL="/my-folder/" . +docker run -d --name it-tools --restart unless-stopped -p 8080:80 it-tools +``` + ## Installation methods | Docker Image | Local Installation |