Skip to content

Modern Docker Management, Designed for Everyone

fix: remove entrypoint to fix file permission issues (#879)

Kyle Mendell3c10e769d6d0
diff --git a/backend/internal/utils/fs/fs_util.go b/backend/internal/utils/fs/fs_util.go
index c3c4b065e..a4c65a3a6 100644
--- a/backend/internal/utils/fs/fs_util.go
+++ b/backend/internal/utils/fs/fs_util.go
@@ -112,6 +112,7 @@ func CreateUniqueDir(projectsRoot, basePath, name string, perm os.FileMode) (pat
}
return "", "", fmt.Errorf("created directory is outside allowed projects root")
}
+
return candidate, folderName, nil
} else if !os.IsExist(mkErr) {
return "", "", mkErr
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 56c54b219..14456ad6a 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -41,22 +41,19 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
FROM alpine:3 AS runner
ARG VERSION="dev"
ARG REVISION="unknown"
-RUN apk upgrade && apk --no-cache add ca-certificates curl shadow su-exec tzdata
-RUN delgroup ping && apk del iputils || true
-ENV DOCKER_GID=998 PUID=2000 PGID=2000
+RUN apk upgrade && apk --no-cache add ca-certificates curl tzdata
ENV GIN_MODE=release
ENV PORT=3552
ENV ENVIRONMENT=production
WORKDIR /app
-RUN mkdir -p /app/data && chmod 755 /app/data
+RUN mkdir -p /app/data
COPY --from=backend-builder /build/arcane .
-COPY --chmod=755 scripts/docker/entrypoint.sh /usr/local/bin/entrypoint.sh
EXPOSE 3552
VOLUME ["/app/data"]
LABEL org.opencontainers.image.authors="OFKM Technologies" \
-org.opencontainers.image.url="https://github.com/ofkm/arcane" \
-org.opencontainers.image.documentation="https://github.com/ofkm/arcane/blob/main/README.md" \
-org.opencontainers.image.source="https://github.com/ofkm/arcane" \
+org.opencontainers.image.url="https://github.com/getarcaneapp/arcane" \
+org.opencontainers.image.documentation="https://github.com/getarcaneapp/arcane/blob/main/README.md" \
+org.opencontainers.image.source="https://github.com/getarcaneapp/arcane" \
org.opencontainers.image.version=${VERSION} \
org.opencontainers.image.revision=${REVISION} \
org.opencontainers.image.licenses="BSD-3-Clause" \
@@ -65,5 +62,4 @@ org.opencontainers.image.title="Arcane" \
org.opencontainers.image.description="Modern Docker Management, Made for Everyone" \
com.ofkm.arcane.updater="false" \
com.ofkm.arcane.server="true"
-ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["./arcane"]
\ No newline at end of file
diff --git a/docker/Dockerfile-agent b/docker/Dockerfile-agent
index 184093518..82ad890c3 100644
--- a/docker/Dockerfile-agent
+++ b/docker/Dockerfile-agent
@@ -29,16 +29,13 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
./cmd/main.go
FROM alpine:3 AS agent
-RUN apk upgrade && apk --no-cache add ca-certificates tzdata curl su-exec
+RUN apk upgrade && apk --no-cache add ca-certificates tzdata curl
WORKDIR /app
-RUN mkdir -p /app/data && chmod 755 /app/data
+RUN mkdir -p /app/data
COPY --from=agent-builder /out/arcane-agent /usr/local/bin/arcane-agent
-COPY --chmod=755 ../scripts/docker/entrypoint.sh /usr/local/bin/entrypoint.sh
-ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
-
ARG VERSION="dev"
ARG REVISION="unknown"
@@ -48,9 +45,9 @@ ENV ENVIRONMENT=production \
PORT=3553
LABEL org.opencontainers.image.authors="OFKM Technologies"
-LABEL org.opencontainers.image.url="https://github.com/ofkm/arcane"
-LABEL org.opencontainers.image.documentation="https://github.com/ofkm/arcane/blob/main/README.md"
-LABEL org.opencontainers.image.source="https://github.com/ofkm/arcane"
+LABEL org.opencontainers.image.url="https://github.com/getarcaneapp/arcane"
+LABEL org.opencontainers.image.documentation="https://github.com/getarcaneapp/arcane/blob/main/README.md"
+LABEL org.opencontainers.image.source="https://github.com/getarcaneapp/arcane"
LABEL org.opencontainers.image.version=$VERSION
LABEL org.opencontainers.image.revision=$REVISION
LABEL org.opencontainers.image.licenses="BSD-3-Clause"
diff --git a/docker/Dockerfile-agent-static b/docker/Dockerfile-agent-static
index 361685a5b..8f4f257ea 100644
--- a/docker/Dockerfile-agent-static
+++ b/docker/Dockerfile-agent-static
@@ -3,25 +3,23 @@ FROM alpine:3
ARG TARGETARCH
WORKDIR /app
-RUN apk upgrade && apk --no-cache add ca-certificates tzdata curl su-exec \
- && (delgroup ping || true) && (apk del iputils || true)
+RUN apk upgrade && apk --no-cache add ca-certificates tzdata curl
+RUN mkdir -p /app/data
COPY ./backend/.bin/arcane-agent-linux-${TARGETARCH} ./arcane-agent
-COPY --chmod=755 ../scripts/docker/entrypoint.sh /usr/local/bin/entrypoint.sh
+ENV ENVIRONMENT=production \
+ AGENT_MODE=true \
+ GIN_MODE=release \
+ PORT=3553
LABEL org.opencontainers.image.title="Arcane Agent"
LABEL org.opencontainers.image.description="Arcane Agent"
LABEL org.opencontainers.image.source="https://github.com/ofkm/arcane"
-
LABEL com.ofkm.arcane.updater="false"
LABEL com.ofkm.arcane.server="true"
EXPOSE 3553
-ENV ENVIRONMENT=production \
- AGENT_MODE=true \
- GIN_MODE=release \
- PORT=3553
+VOLUME ["/app/data"]
-ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["./arcane-agent"]
\ No newline at end of file
diff --git a/docker/Dockerfile-static b/docker/Dockerfile-static
index 6bec6cc8c..77f9efe88 100644
--- a/docker/Dockerfile-static
+++ b/docker/Dockerfile-static
@@ -3,22 +3,22 @@ FROM alpine:3
ARG TARGETARCH
WORKDIR /app
-RUN apk upgrade && apk --no-cache add ca-certificates tzdata curl su-exec \
- && (delgroup ping || true) && (apk del iputils || true)
+RUN apk upgrade && apk --no-cache add ca-certificates tzdata curl
+RUN mkdir -p /app/data
COPY ./backend/.bin/arcane-linux-${TARGETARCH} ./arcane
-COPY --chmod=755 ../scripts/docker/entrypoint.sh /usr/local/bin/entrypoint.sh
+ENV ENVIRONMENT=production
+ENV GIN_MODE=release
+ENV PORT=3552
LABEL org.opencontainers.image.title="Arcane"
LABEL org.opencontainers.image.description="Modern Docker Management, Made for Everyone"
LABEL org.opencontainers.image.source="https://github.com/ofkm/arcane"
-
LABEL com.ofkm.arcane.updater="false"
LABEL com.ofkm.arcane.server="true"
EXPOSE 3552
-ENV ENVIRONMENT=production
+VOLUME ["/app/data"]
-ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["./arcane"]
\ No newline at end of file
diff --git a/examples/compose.agent.yaml b/examples/compose.agent.yaml
index 69bd6a9b3..5bbf5bc45 100644
--- a/examples/compose.agent.yaml
+++ b/examples/compose.agent.yaml
@@ -1,9 +1,9 @@
services:
arcane-agent:
- image: ghcr.io/ofkm/arcane-headless:latest
+ image: ghcr.io/getaracneapp/arcane-headless:latest
container_name: arcane-agent
ports:
- - '3553:3553'
+ - "3553:3553"
environment:
- AGENT_MODE=true
- AGENT_BOOTSTRAP_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxx
diff --git a/examples/compose.basic.yaml b/examples/compose.basic.yaml
index a6070fd95..169732af9 100644
--- a/examples/compose.basic.yaml
+++ b/examples/compose.basic.yaml
@@ -1,6 +1,6 @@
services:
arcane:
- image: ghcr.io/ofkm/arcane:latest
+ image: ghcr.io/getaracneapp/arcane:latest
container_name: arcane
ports:
- "3552:3552"
@@ -9,8 +9,6 @@ services:
- arcane-data:/app/data
- /host/path/to/projects:/app/data/projects
environment:
- - PUID=1000
- - PGID=1000
- ENCRYPTION_KEY=xxxxxxxxxxxxxxxxxxxxxx
- JWT_SECRET=xxxxxxxxxxxxxxxxxxxxxxxxxx
healthcheck:
diff --git a/examples/compose.proxy.yaml b/examples/compose.proxy.yaml
index 07fc1a721..8b951bf0a 100644
--- a/examples/compose.proxy.yaml
+++ b/examples/compose.proxy.yaml
@@ -38,17 +38,15 @@ services:
- no-new-privileges:true
arcane:
- image: ghcr.io/ofkm/arcane:latest
+ image: ghcr.io/getaracneapp/arcane:latest
container_name: arcane
ports:
- "3552:3552"
volumes:
- arcane-data:/app/data
environment:
- - PUID=1000
- - PGID=1000
- - ENCRYPTION_KEY=xxxxxxxxxxxxxxxxxxxxxx # openssl rand -base64 32
- - JWT_SECRET=xxxxxxxxxxxxxxxxxxxxxx # openssl rand -base64 32
+ - ENCRYPTION_KEY=xxxxxxxxxxxxxxxxxxxxxx
+ - JWT_SECRET=xxxxxxxxxxxxxxxxxxxxxx
- DOCKER_HOST=tcp://docker-socket-proxy:2375 # Use the proxy instead of direct socket
networks:
- arcane-internal
diff --git a/scripts/docker/entrypoint.sh b/scripts/docker/entrypoint.sh
deleted file mode 100644
index 948483fb1..000000000
--- a/scripts/docker/entrypoint.sh
+++ /dev/null
@@ -1,206 +0,0 @@
-#!/bin/sh
-set -e
-
-# If we aren't running as root, just exec the CMD
-if [ "$(id -u)" -ne 0 ]; then
- exec "$@"
-fi
-
-# Check if running a CLI subcommand (anything other than bare "arcane" or "/app/arcane")
-QUIET_MODE=false
-case "$1" in
- */arcane|arcane)
- # Check if there's a second argument (subcommand)
- if [ -n "$2" ] && [ "$2" != "" ]; then
- QUIET_MODE=true
- fi
- ;;
-esac
-
-log_entrypoint() {
- if [ "$QUIET_MODE" = "false" ]; then
- echo "$@"
- fi
-}
-
-log_entrypoint "Entrypoint: Setting up user and permissions..."
-
-PUID=${PUID:-2000}
-PGID=${PGID:-2000}
-DOCKER_GID=${DOCKER_GID:-998}
-APP_USER="arcane"
-APP_GROUP="arcane"
-DATA_DIR="/app/data"
-PROJECTS_DIR="${PROJECTS_DIR:-$DATA_DIR/projects}"
-
-log_entrypoint "Entrypoint: Using PUID=${PUID}, PGID=${PGID}, DOCKER_GID=${DOCKER_GID}"
-
-# Create or update the arcane group
-if getent group "$PGID" >/dev/null 2>&1; then
- EXISTING_GROUP=$(getent group "$PGID" | cut -d: -f1)
- if [ "$EXISTING_GROUP" != "$APP_GROUP" ]; then
- log_entrypoint "Entrypoint: Group with GID ${PGID} exists as '${EXISTING_GROUP}', using it..."
- APP_GROUP="$EXISTING_GROUP"
- fi
-else
- log_entrypoint "Entrypoint: Creating group ${APP_GROUP} with GID ${PGID}..."
- addgroup -g "$PGID" "$APP_GROUP"
-fi
-
-# Create or update the arcane user
-if getent passwd "$PUID" >/dev/null 2>&1; then
- EXISTING_USER=$(getent passwd "$PUID" | cut -d: -f1)
- if [ "$EXISTING_USER" != "$APP_USER" ] && [ "$EXISTING_USER" != "root" ]; then
- log_entrypoint "Entrypoint: Renaming user ${EXISTING_USER} to ${APP_USER}..."
- usermod -l "$APP_USER" -g "$PGID" "$EXISTING_USER" 2>/dev/null || true
- elif [ "$EXISTING_USER" = "$APP_USER" ]; then
- log_entrypoint "Entrypoint: User ${APP_USER} already exists with UID ${PUID}"
- usermod -g "$PGID" "$APP_USER" 2>/dev/null || true
- fi
-else
- log_entrypoint "Entrypoint: Creating user ${APP_USER} with UID ${PUID}..."
- adduser -D -u "$PUID" -G "$APP_GROUP" "$APP_USER"
-fi
-
-# Handle Docker socket and group
-# Skip socket configuration if using TCP proxy (DOCKER_HOST with tcp://)
-if [ -n "$DOCKER_HOST" ] && echo "$DOCKER_HOST" | grep -q "^tcp://"; then
- log_entrypoint "Entrypoint: Docker proxy mode detected (DOCKER_HOST=${DOCKER_HOST}), skipping socket setup"
-elif [ -S /var/run/docker.sock ]; then
- SOCKET_GID=$(stat -c '%g' /var/run/docker.sock)
- log_entrypoint "Entrypoint: Docker socket found with GID ${SOCKET_GID}"
- if [ "$SOCKET_GID" = "0" ]; then
- log_entrypoint "Entrypoint: Docker socket owned by root group (GID 0), adding ${APP_USER} to root group..."
- addgroup "$APP_USER" root
- log_entrypoint "Entrypoint: Docker socket configured (using root group)"
- else
- if getent group docker >/dev/null 2>&1; then
- CURRENT_DOCKER_GID=$(getent group docker | cut -d: -f3)
- if [ "$CURRENT_DOCKER_GID" != "$SOCKET_GID" ]; then
- log_entrypoint "Entrypoint: Updating docker group GID from ${CURRENT_DOCKER_GID} to ${SOCKET_GID}..."
- groupmod -g "$SOCKET_GID" docker 2>/dev/null || {
- delgroup docker 2>/dev/null || true
- addgroup -g "$SOCKET_GID" docker
- }
- fi
- # Ensure user is in docker group
- if ! id -nG "$APP_USER" | grep -qw "docker"; then
- log_entrypoint "Entrypoint: Adding ${APP_USER} to docker group..."
- addgroup "$APP_USER" docker
- fi
- else
- # Check if SOCKET_GID is already in use by another group
- if getent group "$SOCKET_GID" >/dev/null 2>&1; then
- EXISTING_GROUP=$(getent group "$SOCKET_GID" | cut -d: -f1)
- log_entrypoint "Entrypoint: GID ${SOCKET_GID} already used by group '${EXISTING_GROUP}'"
- if [ "$EXISTING_GROUP" != "docker" ]; then
- log_entrypoint "Entrypoint: Adding ${APP_USER} to ${EXISTING_GROUP} for Docker socket access..."
- addgroup "$APP_USER" "$EXISTING_GROUP"
- fi
- else
- log_entrypoint "Entrypoint: Creating docker group with GID ${SOCKET_GID}..."
- addgroup -g "$SOCKET_GID" docker
- # Add user to newly created docker group
- if ! id -nG "$APP_USER" | grep -qw "docker"; then
- log_entrypoint "Entrypoint: Adding ${APP_USER} to docker group..."
- addgroup "$APP_USER" docker
- fi
- fi
- fi
- log_entrypoint "Entrypoint: Docker socket configured (GID: ${SOCKET_GID})"
- fi
-else
- echo "WARNING: Docker socket not found at /var/run/docker.sock"
- if ! getent group docker >/dev/null 2>&1; then
- log_entrypoint "Entrypoint: Creating docker group with default GID ${DOCKER_GID}..."
- addgroup -g "$DOCKER_GID" docker
- addgroup "$APP_USER" docker
- fi
-fi
-
-is_mountpoint() {
- local p="$1"
- if command -v mountpoint >/dev/null 2>&1; then
- mountpoint -q -- "$p"
- return $?
- fi
-
- local dev_self dev_parent
- dev_self=$(stat -c '%d' -- "$p" 2>/dev/null || echo "")
- dev_parent=$(stat -c '%d' -- "$(dirname -- "$p")" 2>/dev/null || echo "")
- [ -n "$dev_self" ] && [ -n "$dev_parent" ] && [ "$dev_self" != "$dev_parent" ]
-}
-
-log_entrypoint "Entrypoint: Setting up data directory..."
-mkdir -p "$DATA_DIR"
-
-# If projects dir exists and is a separate mount, do not chown it recursively.
-SKIP_PROJECTS_CHOWN=false
-if [ -d "$PROJECTS_DIR" ] && is_mountpoint "$PROJECTS_DIR"; then
- log_entrypoint "Entrypoint: Detected bind-mounted projects at $PROJECTS_DIR; skipping recursive chown"
- SKIP_PROJECTS_CHOWN=true
-fi
-
-# Always ensure /app/data itself is owned and writable does not touch projects folder
-chown "${PUID}:${PGID}" "$DATA_DIR" || true
-chmod 775 "$DATA_DIR" || true
-
-# Chown everything under /app/data except projects if skipped
-if [ "$SKIP_PROJECTS_CHOWN" = "true" ]; then
- for entry in "$DATA_DIR"/*; do
- [ -e "$entry" ] || continue
- [ "$entry" = "$PROJECTS_DIR" ] && continue
- chown -R "${PUID}:${PGID}" "$entry" || true
- done
-else
- chown -R "${PUID}:${PGID}" "$DATA_DIR" || true
-fi
-
-# Grant access to bind-mounted projects without changing host ownership:
-# Map the container user into the host GID owning the projects dir.
-if [ -d "$PROJECTS_DIR" ]; then
- # Prefer a real entry inside the mount (some mounts mask dir metadata)
- PRJ_PATH="$PROJECTS_DIR"
- CANDIDATE="$(find "$PROJECTS_DIR" -mindepth 1 -maxdepth 1 -print -quit 2>/dev/null || true)"
- if [ -n "$CANDIDATE" ]; then
- PRJ_PATH="$CANDIDATE"
- fi
- PRJ_UID="$(stat -c '%u' "$PRJ_PATH" 2>/dev/null || echo "")"
- PRJ_GID="$(stat -c '%g' "$PRJ_PATH" 2>/dev/null || echo "")"
-
- log_entrypoint "Entrypoint: Projects path used for GID detection: $PRJ_PATH (uid:$PRJ_UID gid:$PRJ_GID)"
- if [ -n "$PRJ_GID" ]; then
- if getent group "$PRJ_GID" >/dev/null 2>&1; then
- HOST_GROUP=$(getent group "$PRJ_GID" | cut -d: -f1)
- else
- HOST_GROUP="hostgid_${PRJ_GID}"
- log_entrypoint "Entrypoint: Creating group ${HOST_GROUP} with GID ${PRJ_GID} for projects access"
- addgroup -g "$PRJ_GID" "$HOST_GROUP"
- fi
- if ! id -nG "$APP_USER" | grep -qw "$HOST_GROUP"; then
- log_entrypoint "Entrypoint: Adding ${APP_USER} to ${HOST_GROUP} (GID ${PRJ_GID})"
- addgroup "$APP_USER" "$HOST_GROUP"
- fi
-
- # Check writability; if still not writable, warn but do not chown host files.
- if ! su-exec "$APP_USER" sh -c "test -w '$PROJECTS_DIR'"; then
- echo "WARNING: Projects directory ($PROJECTS_DIR) is not writable by ${APP_USER} even after group mapping."
- echo "WARNING: Host permissions may be too restrictive (e.g., 700). Not modifying host ownership."
- fi
- fi
-fi
-
-# Verify /app/data is writable before starting
-if ! su-exec "$APP_USER" sh -lc "test -w '$DATA_DIR' && touch '$DATA_DIR/.rwtest' && rm -f '$DATA_DIR/.rwtest'"; then
- echo "ERROR: $DATA_DIR is not writable by ${APP_USER}. Check volume permissions."
- exit 1
-fi
-
-# Ensure app directory ownership
-chown "${PUID}:${PGID}" /app
-
-# Favor group-writable files created by the app
-umask 002
-
-log_entrypoint "Entrypoint: Setup complete. Starting as ${APP_USER} (UID: ${PUID}, GID: ${PGID})"
-exec su-exec "$APP_USER" "$@"