Skip to content

Commit

Permalink
fix: composync user add to docker group
Browse files Browse the repository at this point in the history
  • Loading branch information
pieceowater committed Oct 6, 2024
1 parent 27fbd3c commit 3804527
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ FROM alpine:latest

# Create a non-root user and group
RUN addgroup -S composync && adduser -S composync -G composync
RUN addgroup -S docker && adduser composync docker

# Install runtime dependencies including bash, git, and Docker CLI
RUN apk add --no-cache \
Expand All @@ -40,9 +41,6 @@ RUN apk add --no-cache \
RUN curl -L "https://github.com/docker/compose/releases/download/v2.14.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && \
chmod +x /usr/local/bin/docker-compose

# Change permissions of Docker socket to allow access to the docker group
RUN chown root:docker /var/run/docker.sock && chmod 660 /var/run/docker.sock

# Copy the built Go application from the builder stage
COPY --from=builder /app/composync /usr/local/bin/composync

Expand All @@ -54,14 +52,11 @@ COPY entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh && \
chown composync:composync /usr/local/bin/entrypoint.sh

# Add composync to the docker group for access to the socket
RUN addgroup composync docker

# Switch to the composync user
USER composync

# Set the entrypoint for the container
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]

# Default command (uses environment variables)
CMD ["go", "--interval=${INTERVAL}", "--repo=${REPO_URL}", "--branch=${BRANCH}", "--scan-dir=${SCAN_DIR}", "--recursive=${RECURSIVE}", "--username=${GIT_USERNAME}", "--token=${GIT_PAT}"]
CMD ["go", "--interval=${INTERVAL}", "--repo=${REPO_URL}", "--branch=${BRANCH}", "--scan-dir=${SCAN_DIR}", "--recursive=${RECURSIVE}", "--username=${GIT_USERNAME}", "--token=${GIT_PAT}"]

0 comments on commit 3804527

Please sign in to comment.