pass in UID and GID so hounted volumes have correct owner (todo: make it dynameic)

This commit is contained in:
Gitea 2020-12-11 11:14:32 +00:00
parent e95651837f
commit fcc6b97d58
3 changed files with 15 additions and 4 deletions

2
.env Normal file
View File

@ -0,0 +1,2 @@
UID=1002 #$(id -u)
GID=1002 #$(id -g)

View File

@ -1,6 +1,9 @@
FROM golang:1.15-alpine3.12
ARG GOPROXY
ARG UID
ARG GID
ENV GOPROXY ${GOPROXY:-direct}
ARG GITEA_VERSION
@ -15,6 +18,8 @@ WORKDIR /src
EXPOSE 22 3000
RUN echo DEBUG: "gg ${GID} uu ${UID}"
RUN apk --no-cache add \
bash \
ca-certificates \
@ -29,13 +34,13 @@ RUN apk --no-cache add \
gnupg
RUN addgroup \
-S -g 1000 \
-S -g ${GID} \
git && \
adduser \
-S -H -D \
-h /home/git \
-s /bin/bash \
-u 1000 \
-u ${UID} \
-G git \
git && \
echo "git:$(dd if=/dev/urandom bs=24 count=1 status=none | base64)" | chpasswd

View File

@ -1,10 +1,14 @@
version: '3.1'
services:
gitea-dev:
build: dev
build:
context: dev
args:
UID: "${UID}"
GID: "${GID}"
ports:
- 3000:3000
user: 1000:1000
user: "${UID}:${GID}"
volumes:
- ./home:/home
- ./src:/src