Skip to content

Commit 1bcc0ac

Browse files
committed
fix(Dockerfile): allow base url in build
and explained in readme
1 parent e0ea732 commit 1bcc0ac

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,14 @@ WORKDIR /app
88
COPY package.json pnpm-lock.yaml ./
99
RUN npm install -g pnpm && pnpm i --frozen-lockfile
1010
COPY . .
11+
ARG BASE_URL
12+
ENV BASE_URL=${BASE_URL}
1113
RUN pnpm build
1214

1315
# production stage
1416
FROM nginx:stable-alpine AS production-stage
17+
ARG BASE_URL
18+
ENV BASE_URL=${BASE_URL}
1519
COPY --from=build-stage /app/dist /usr/share/nginx/html
1620
COPY nginx.conf /etc/nginx/conf.d/default.conf
1721
EXPOSE 80

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ You can use my image in your docker-compose file if you want an update to date v
1010

1111
Almost [all tools PR of it-tools](https://github.com/CorentinTh/it-tools/pulls).
1212

13+
## Build docker image for a subfolder
14+
15+
According to https://github.com/CorentinTh/it-tools/pull/461#issuecomment-1602506049:
16+
```
17+
docker build -t it-tools --build-arg BASE_URL="/my-folder/" .
18+
docker run -d --name it-tools --restart unless-stopped -p 8080:80 it-tools
19+
```
20+
1321
## Installation methods
1422

1523
| Docker Image | Local Installation |

0 commit comments

Comments
 (0)