File tree Expand file tree Collapse file tree 2 files changed +33
-3
lines changed Expand file tree Collapse file tree 2 files changed +33
-3
lines changed Original file line number Diff line number Diff line change
1
+ FROM golang:1.23.4-alpine
2
+
3
+ WORKDIR /app
4
+
5
+ COPY go.mod .
6
+ COPY go.sum .
7
+ RUN go mod download
8
+
9
+ COPY *.go .
10
+ COPY store/*.go store/
11
+ COPY schema.sql .
12
+ RUN go build -o clidle .
13
+
14
+ FROM scratch
15
+
16
+ COPY --from=0 /app/clidle .
17
+
18
+ ENV CLICOLOR_FORCE=1
19
+ ENV CLIDLE_DATA_DIR=/opt/clidle/data
20
+ CMD ["./clidle" , "-serve" , "0.0.0.0:22" ]
Original file line number Diff line number Diff line change @@ -27,9 +27,9 @@ import (
27
27
var (
28
28
// pathClidle is the path to the local data directory.
29
29
// This is usually set to ~/.local/share/clidle on most UNIX systems.
30
- pathClidle = filepath . Join ( xdg . DataHome , "clidle" )
31
- pathStore = filepath . Join ( pathClidle , "clidle.db" )
32
- pathHostKey = filepath . Join ( pathClidle , "hostkey" )
30
+ pathClidle string
31
+ pathStore string
32
+ pathHostKey string
33
33
34
34
//go:embed schema.sql
35
35
schemaSQL string
41
41
}
42
42
)
43
43
44
+ func init () {
45
+ pathClidle = os .Getenv ("CLIDLE_DATA_DIR" )
46
+ if pathClidle == "" {
47
+ pathClidle = filepath .Join (xdg .DataHome , "clidle" )
48
+ }
49
+
50
+ pathStore = filepath .Join (pathClidle , "clidle.db" )
51
+ pathHostKey = filepath .Join (pathClidle , "hostkey" )
52
+ }
53
+
44
54
func main () {
45
55
flagServe := flag .String ("serve" , "" , "Spawns an SSH server on the given address (format: 0.0.0.0:1337)" )
46
56
flag .Parse ()
You can’t perform that action at this time.
0 commit comments