Skip to content

Commit

Permalink
Use LDFLAGS to set the default locations in docker
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
zeripath committed Oct 31, 2021
1 parent 4e8a817 commit 3d764b2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ ENV GOPROXY ${GOPROXY:-direct}
ARG GITEA_VERSION
ARG TAGS="sqlite sqlite_unlock_notify"
ENV TAGS "bindata timetzdata $TAGS"
ENV LDFLAGS="$LDFLAGS -X \"code.gitea.io/gitea/modules/setting.CustomPath=/data/gitea\" \
-X \"code.gitea.io/gitea/modules/setting.AppWorkPath=/app/gitea\""
ARG CGO_EXTRA_CFLAGS

#Build deps
Expand Down
3 changes: 3 additions & 0 deletions Dockerfile.rootless
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ ENV GOPROXY ${GOPROXY:-direct}
ARG GITEA_VERSION
ARG TAGS="sqlite sqlite_unlock_notify"
ENV TAGS "bindata timetzdata $TAGS"
ENV LDFLAGS="$LDFLAGS -X \"code.gitea.io/gitea/modules/setting.CustomPath=/var/lib/gitea/custom\" \
-X \"code.gitea.io/gitea/modules/setting.CustomConf=/etc/gitea/conf.ini\" \
-X \"code.gitea.io/gitea/modules/setting.AppWorkPath=/var/lib/gitea\""
ARG CGO_EXTRA_CFLAGS

#Build deps
Expand Down

0 comments on commit 3d764b2

Please sign in to comment.