Skip to content

Commit fb23bd5

Browse files
authored
Fix empty WebUI static assets directory
1 parent 6974f54 commit fb23bd5

File tree

11 files changed

+27
-19
lines changed

11 files changed

+27
-19
lines changed

.github/workflows/build.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323

2424
- name: Build webui
2525
run: |
26-
make generate-webui
26+
make clean-webui generate-webui
2727
tar czvf webui.tar.gz ./webui/static/
2828
2929
- name: Artifact webui

.github/workflows/test-unit.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
restore-keys: ${{ runner.os }}-test-unit-go-
4141

4242
- name: Avoid generating webui
43-
run: mkdir -p webui/static && touch webui/static/index.html
43+
run: touch webui/static/index.html
4444

4545
- name: Tests
4646
run: make test-unit

.github/workflows/validate.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
run: curl -sfL https://raw.githubusercontent.com/client9/misspell/master/install-misspell.sh | sh -s -- -b $(go env GOPATH)/bin ${MISSSPELL_VERSION}
4949

5050
- name: Avoid generating webui
51-
run: mkdir -p webui/static && touch webui/static/index.html
51+
run: touch webui/static/index.html
5252

5353
- name: Validate
5454
run: make validate

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
.DS_Store
66
/dist
77
/webui/.tmp/
8-
/webui/static/
98
/site/
109
/docs/site/
1110
/autogen/

.semaphore/semaphore.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ blocks:
4040
- name: Test Integration
4141
commands:
4242
- make pull-images
43-
- mkdir -p webui/static && touch webui/static/index.html # Avoid generating webui
43+
- touch webui/static/index.html # Avoid generating webui
4444
- PRE_TARGET="" make binary
4545
- make test-integration
4646
- df -h

Makefile

+8-5
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,18 @@ dist:
5858
build-webui-image:
5959
docker build -t traefik-webui --build-arg ARG_PLATFORM_URL=$(PLATFORM_URL) -f webui/Dockerfile webui
6060

61+
## Clean WebUI static generated assets
62+
clean-webui:
63+
rm -r webui/static
64+
mkdir -p webui/static
65+
echo 'For more information show `webui/readme.md`' > webui/static/DONT-EDIT-FILES-IN-THIS-DIRECTORY.md
66+
6167
## Generate WebUI
6268
generate-webui:
63-
if [ ! -d "webui/static" ]; then \
69+
if [ ! -f "webui/static/index.html" ]; then \
6470
$(MAKE) build-webui-image; \
65-
mkdir -p webui/static; \
6671
docker run --rm -v "$$PWD/webui/static":'/src/webui/static' traefik-webui npm run build:nc; \
6772
docker run --rm -v "$$PWD/webui/static":'/src/webui/static' traefik-webui chown -R $(shell id -u):$(shell id -g) ./static; \
68-
echo 'For more information show `webui/readme.md`' > $$PWD/webui/static/DONT-EDIT-FILES-IN-THIS-DIRECTORY.md; \
6973
fi
7074

7175
## Build the linux binary
@@ -114,8 +118,7 @@ validate: $(PRE_TARGET)
114118
bash $(CURDIR)/script/validate-shell-script.sh
115119

116120
## Clean up static directory and build a Docker Traefik image
117-
build-image: binary
118-
rm -rf webui/static
121+
build-image: clean-webui binary
119122
docker build -t $(TRAEFIK_IMAGE) .
120123

121124
## Build a Docker Traefik image

docs/content/contributing/building-testing.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ Once you've set up your go environment and cloned the source repository, you can
102102

103103
```bash
104104
# Generate UI static files
105-
rm -rf ./webui/static/; make generate-webui
105+
make clean-webui generate-webui
106106

107107
# required to merge non-code components into the final binary,
108108
# such as the web dashboard/UI

webui/.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,7 @@ yarn-error.log*
2626
# local env files
2727
.env.local
2828
.env.*.local
29+
30+
# static assets (ignore all except the DO NOT EDIT file)
31+
static/*
32+
!static/DONT-EDIT-FILES-IN-THIS-DIRECTORY.md

webui/dev/scripts/transfer.js

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const folder = process.argv[2]
55
async function execute () {
66
try {
77
await fs.emptyDir('./static')
8+
await fs.outputFile('./static/DONT-EDIT-FILES-IN-THIS-DIRECTORY.md', 'For more information show `webui/readme.md`')
89
console.log('Deleted static folder contents!')
910
await fs.copy(`./dist/${folder}`, './static', { overwrite: true })
1011
console.log('Installed new files in static folder!')

webui/readme.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ Traefik Web UI provide 2 types of information:
1414
Use the make file :
1515

1616
```shell
17-
make build-image # Generate Docker image
18-
make generate-webui # Generate static contents in `traefik/webui/static/` folder.
17+
make build-image # Generate Docker image.
18+
make clean-webui generate-webui # Generate static contents in `webui/static/` folder.
1919
```
2020

2121
## How to build (only for frontend developer)
2222

2323
- prerequisite: [Node 12.11+](https://nodejs.org) [Npm](https://www.npmjs.com/)
2424

25-
- Go to the `webui` directory
25+
- Go to the `webui/` directory
2626

2727
- To install dependencies, execute the following commands:
2828

@@ -32,9 +32,9 @@ make generate-webui # Generate static contents in `traefik/webui/static/` fold
3232

3333
- `npm run build`
3434

35-
- Static contents are built in the `webui/static` directory
35+
- Static contents are built in the `webui/static/` directory
3636

37-
**Do not manually change the files in the `webui/static` directory**
37+
**Do not manually change the files in the `webui/static/` directory**
3838

3939
- The build allows to:
4040
- optimize all JavaScript
@@ -46,10 +46,10 @@ make generate-webui # Generate static contents in `traefik/webui/static/` fold
4646

4747
## How to edit (only for frontend developer)
4848

49-
**Do not manually change the files in the `webui/static` directory**
49+
**Do not manually change the files in the `webui/static/` directory**
5050

51-
- Go to the `webui` directory
52-
- Edit files in `webui/src`
51+
- Go to the `webui/` directory
52+
- Edit files in `webui/src/`
5353
- Run in development mode :
5454
- `npm run dev`
5555

Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
For more information show `webui/readme.md`

0 commit comments

Comments
 (0)