Skip to content

Commit 932a29d

Browse files
committed
Refactoring directory structure, to embed static thins into the docker container
1 parent d903cd9 commit 932a29d

29 files changed

+45
-32
lines changed

Dockerfile

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,14 @@ RUN GO111MODULE=auto CGO_ENABLED=0 GOOS=linux go build -a -o glowdash \
1414
FROM alpine AS glowdash
1515
LABEL maintainer="hyper80@gmail.com" \
1616
description="GlowDash - Smart Home Web Dashboard"
17+
RUN mkdir /glowdash \
18+
&& mkdir /glowdash/static \
19+
&& mkdir /glowdash/user \
20+
&& mkdir /glowdash/config
21+
COPY static/* /glowdash/static/
1722
COPY --from=glowdashbuildstage /glowdash/glowdash /usr/local/bin
1823
COPY --from=glowdashbuildstage /usr/share/zoneinfo /usr/share/zoneinfo
19-
RUN mkdir /glowdash
20-
VOLUME ["/glowdash"]
24+
VOLUME ["/glowdash/user"]
25+
VOLUME ["/glowdash/config"]
2126
WORKDIR /glowdash
22-
CMD ["/usr/local/bin/glowdash","/glowdash/config.yml"]
27+
CMD ["/usr/local/bin/glowdash","/glowdash/config/running.yml"]

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,20 @@ Available amd64 and arm64 linux containers on Docker hub:
5050
Compile / Install
5151
-----------------
5252
It is recommended to use docker compose.
53-
If you do so, the config file is the "storage/config.yml" and your user images can be put into "storage/user"
53+
If you do so, the config file is the "config/running.yml" and your user images can be put into "userstuff"
5454
directory. After that, just edit the config file according to your needs and run the container
5555

56-
cat docs/config-samples/minimal.yml > storage/config.yml
56+
cat config/minimal.yml > config/running.yml
5757
docker compose up -d
5858

5959

6060
If you still want to compile it yourself, add the dependencies and compile all the *.go files
6161

6262
export GO111MODULE=auto
63-
go install github.com/hyper-prog/smartjson
64-
go install github.com/hyper-prog/smartyaml
63+
go mod download
6564

6665
go build -o glowdash glowdash/*.go
67-
./glowdash myconfig.yml
66+
./glowdash config/running.yml
6867

6968
Other devices, Future
7069
---------------------

config/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
Here is the location of config files and the saved schedules
3+
The docker compose mount this folder.
4+
5+
The "running.yml" is the config started by docker compose

docs/config-samples/big-sample-config.yml renamed to config/big-sample-config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ GlowDash:
77
ApiKey: 1234sample5678
88
Location: Budapest
99
DebugLevel: 0 # 0 - silent, 1,2,3,4...
10-
StaticDirectory: "static" # Location of static glowdash files,js,css, images
11-
UserDirectory: "user" # Location of user images
12-
StateConfigDirectory: "." # Location where the scheduled tasks file is saved
10+
StaticDirectory: "static" # Location of static glowdash files,js,css, images
11+
UserDirectory: "user" # Location of user images
12+
StateConfigDirectory: "config" # Location where the scheduled tasks file is saved
1313
WebUseSSE: 1 # 0: disabled, 1: Make the browsers connect to SSE server
1414
WebSSEPort: 5018 # The port of SSE server listen on
1515
CommUseSSE: 1 # 0: disabled, 1: Enable the Glowdash notify SSE server

config/minimal.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
GlowDash:
2+
DashboardTitle: "GlowDash" #Show in main title line (You can change to your home name)
3+
ReadWindInfo: false #If true: reads some wind informations and show in title line
4+
DebugLevel: 0 # 0 - silent, 1,2,3,4...
5+
StaticDirectory: "static" # Location of static glowdash files,js,css, images
6+
UserDirectory: "user" # Location of user images
7+
StateConfigDirectory: "config" # Location where the scheduled tasks file is saved
8+
WebUseSSE: 0 # 0: disabled, 1: Make the browsers connect to SSE server
9+
CommUseSSE: 0 # 0: disabled, 1: Enable the Glowdash notify SSE server
10+
Panels: # You can define panels here
11+
- Title: Shedule editor
12+
PanelType: Launch
13+
Thumbnail: schedules.png
14+
LaunchTo: schedpage
15+
16+
Pages:
17+
- Title: Scheduled tasks
18+
PageType: ScheduleEdit
19+
PageName: schedpage

docker-compose.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ services:
77
ports:
88
- "80:80"
99
volumes:
10-
- ./storage:/glowdash
10+
- ./userstuff:/glowdash/user
11+
- ./config:/glowdash/config

docs/config-samples/minimal.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

docs/local-docker-compose-file/docker-compose.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ services:
77
ports:
88
- "80:80"
99
volumes:
10-
- ./storage:/glowdash
10+
- ./userstuff:/glowdash/user
11+
- ./config:/glowdash/config
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)