Skip to content

Commit 3d764b2

Browse files
committed
Use LDFLAGS to set the default locations in docker
Too many docker users are caught out by the default location for the app.ini file being environment dependent so that when they docker exec into the container the `gitea` commands do not work properly and require additional `-c` arguments to correctly pick up the configuration. This PR simply builds the default locations into the build. Fix go-gitea#14468 Reference go-gitea#17497 Reference go-gitea#12082 Reference go-gitea#8941 ... amongst others ... Signed-off-by: Andrew Thornton <art27@cantab.net>
1 parent 4e8a817 commit 3d764b2

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

Dockerfile

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ ENV GOPROXY ${GOPROXY:-direct}
99
ARG GITEA_VERSION
1010
ARG TAGS="sqlite sqlite_unlock_notify"
1111
ENV TAGS "bindata timetzdata $TAGS"
12+
ENV LDFLAGS="$LDFLAGS -X \"code.gitea.io/gitea/modules/setting.CustomPath=/data/gitea\" \
13+
-X \"code.gitea.io/gitea/modules/setting.AppWorkPath=/app/gitea\""
1214
ARG CGO_EXTRA_CFLAGS
1315

1416
#Build deps

Dockerfile.rootless

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ ENV GOPROXY ${GOPROXY:-direct}
99
ARG GITEA_VERSION
1010
ARG TAGS="sqlite sqlite_unlock_notify"
1111
ENV TAGS "bindata timetzdata $TAGS"
12+
ENV LDFLAGS="$LDFLAGS -X \"code.gitea.io/gitea/modules/setting.CustomPath=/var/lib/gitea/custom\" \
13+
-X \"code.gitea.io/gitea/modules/setting.CustomConf=/etc/gitea/conf.ini\" \
14+
-X \"code.gitea.io/gitea/modules/setting.AppWorkPath=/var/lib/gitea\""
1215
ARG CGO_EXTRA_CFLAGS
1316

1417
#Build deps

0 commit comments

Comments
 (0)