Enhance Docker configuration with UID and GID arguments for improved user permissions
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -32,13 +32,16 @@ steps:
|
|||||||
- name: docker-build-validate
|
- name: docker-build-validate
|
||||||
image: gcr.io/kaniko-project/executor:v1.23.2-debug
|
image: gcr.io/kaniko-project/executor:v1.23.2-debug
|
||||||
commands:
|
commands:
|
||||||
- /kaniko/executor --context "${DRONE_WORKSPACE}" --dockerfile "${DRONE_WORKSPACE}/Dockerfile" --no-push --destination xteve:validate --build-arg TARGETOS=linux --build-arg TARGETARCH=amd64
|
- /kaniko/executor --context "${DRONE_WORKSPACE}" --dockerfile "${DRONE_WORKSPACE}/Dockerfile" --no-push --destination xteve:validate --build-arg TARGETOS=linux --build-arg TARGETARCH=amd64 --build-arg XTEVE_UID=1000 --build-arg XTEVE_GID=1000
|
||||||
when:
|
when:
|
||||||
event:
|
event:
|
||||||
- pull_request
|
- pull_request
|
||||||
|
|
||||||
- name: docker-publish
|
- name: docker-publish
|
||||||
image: plugins/docker
|
image: plugins/docker
|
||||||
|
environment:
|
||||||
|
XTEVE_UID: "1000"
|
||||||
|
XTEVE_GID: "1000"
|
||||||
settings:
|
settings:
|
||||||
registry: registry.coadcorp.com
|
registry: registry.coadcorp.com
|
||||||
repo: registry.coadcorp.com/nathan/xteve
|
repo: registry.coadcorp.com/nathan/xteve
|
||||||
@@ -52,6 +55,9 @@ steps:
|
|||||||
build_args:
|
build_args:
|
||||||
- TARGETOS=linux
|
- TARGETOS=linux
|
||||||
- TARGETARCH=amd64
|
- TARGETARCH=amd64
|
||||||
|
build_args_from_env:
|
||||||
|
- XTEVE_UID
|
||||||
|
- XTEVE_GID
|
||||||
when:
|
when:
|
||||||
event:
|
event:
|
||||||
- push
|
- push
|
||||||
|
|||||||
@@ -23,9 +23,12 @@ FROM mwader/static-ffmpeg:latest AS ffmpeg
|
|||||||
|
|
||||||
FROM alpine:3.23
|
FROM alpine:3.23
|
||||||
|
|
||||||
|
ARG XTEVE_UID=1000
|
||||||
|
ARG XTEVE_GID=1000
|
||||||
|
|
||||||
RUN apk add --no-cache ca-certificates tzdata \
|
RUN apk add --no-cache ca-certificates tzdata \
|
||||||
&& addgroup -S xteve \
|
&& addgroup -S -g "${XTEVE_GID}" xteve \
|
||||||
&& adduser -S -G xteve xteve \
|
&& adduser -S -D -H -u "${XTEVE_UID}" -G xteve xteve \
|
||||||
&& mkdir -p /xteve/config \
|
&& mkdir -p /xteve/config \
|
||||||
&& chown -R xteve:xteve /xteve
|
&& chown -R xteve:xteve /xteve
|
||||||
|
|
||||||
|
|||||||
@@ -3,11 +3,16 @@ services:
|
|||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
|
args:
|
||||||
|
XTEVE_UID: ${XTEVE_UID:-1000}
|
||||||
|
XTEVE_GID: ${XTEVE_GID:-1000}
|
||||||
container_name: xteve
|
container_name: xteve
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
network_mode: host
|
network_mode: host
|
||||||
environment:
|
environment:
|
||||||
XTEVE_CONFIG: /xteve/config
|
XTEVE_CONFIG: /xteve/config
|
||||||
XTEVE_PORT: "34400"
|
XTEVE_PORT: "34400"
|
||||||
|
XTEVE_UID: ${XTEVE_UID:-1000}
|
||||||
|
XTEVE_GID: ${XTEVE_GID:-1000}
|
||||||
volumes:
|
volumes:
|
||||||
- ./docker-data/config:/xteve/config
|
- ./docker-data/config:/xteve/config
|
||||||
|
|||||||
@@ -3,11 +3,16 @@ services:
|
|||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
|
args:
|
||||||
|
XTEVE_UID: ${XTEVE_UID:-1000}
|
||||||
|
XTEVE_GID: ${XTEVE_GID:-1000}
|
||||||
container_name: xteve
|
container_name: xteve
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
XTEVE_CONFIG: /xteve/config
|
XTEVE_CONFIG: /xteve/config
|
||||||
XTEVE_PORT: "34400"
|
XTEVE_PORT: "34400"
|
||||||
|
XTEVE_UID: ${XTEVE_UID:-1000}
|
||||||
|
XTEVE_GID: ${XTEVE_GID:-1000}
|
||||||
ports:
|
ports:
|
||||||
- "34400:34400/tcp"
|
- "34400:34400/tcp"
|
||||||
- "1900:1900/udp"
|
- "1900:1900/udp"
|
||||||
|
|||||||
@@ -81,12 +81,15 @@ fi
|
|||||||
|
|
||||||
if ! touch "${CONFIG_DIR}/.xteve-write-test" 2>/dev/null; then
|
if ! touch "${CONFIG_DIR}/.xteve-write-test" 2>/dev/null; then
|
||||||
echo "[entrypoint] ERROR: Config directory is not writable: ${CONFIG_DIR}" >&2
|
echo "[entrypoint] ERROR: Config directory is not writable: ${CONFIG_DIR}" >&2
|
||||||
|
echo "[entrypoint] Running as UID:GID $(id -u):$(id -g)" >&2
|
||||||
ls -ld "${CONFIG_DIR}" >&2 || true
|
ls -ld "${CONFIG_DIR}" >&2 || true
|
||||||
|
echo "[entrypoint] Hint: ensure host path ownership/permissions allow this UID:GID to write, or set matching container UID/GID at build time." >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
rm -f "${CONFIG_DIR}/.xteve-write-test"
|
rm -f "${CONFIG_DIR}/.xteve-write-test"
|
||||||
|
|
||||||
echo "[entrypoint] Using config directory: ${CONFIG_DIR}"
|
echo "[entrypoint] Using config directory: ${CONFIG_DIR}"
|
||||||
|
echo "[entrypoint] Running as UID:GID $(id -u):$(id -g)"
|
||||||
if [ -f "${CONFIG_DIR}/settings.json" ]; then
|
if [ -f "${CONFIG_DIR}/settings.json" ]; then
|
||||||
echo "[entrypoint] settings.json details: $(ls -l "${CONFIG_DIR}/settings.json" | awk '{print $1, $3, $4, $5, $9}')"
|
echo "[entrypoint] settings.json details: $(ls -l "${CONFIG_DIR}/settings.json" | awk '{print $1, $3, $4, $5, $9}')"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user