Fix Docker Compose and Dockerfile issues: remove image pull, fix entrypoint permissions
This commit is contained in:
@@ -25,21 +25,21 @@ WORKDIR /app
|
||||
|
||||
COPY --from=builder /app/nerd-monitor-agent .
|
||||
|
||||
# Create entrypoint script BEFORE switching users
|
||||
RUN echo '#!/bin/sh' > /app/entrypoint.sh && \
|
||||
echo 'SERVER=${SERVER:-localhost:8080}' >> /app/entrypoint.sh && \
|
||||
echo 'INTERVAL=${INTERVAL:-15s}' >> /app/entrypoint.sh && \
|
||||
echo 'AGENT_ID=${AGENT_ID:-}' >> /app/entrypoint.sh && \
|
||||
echo 'if [ -z "$AGENT_ID" ]; then' >> /app/entrypoint.sh && \
|
||||
echo ' exec ./nerd-monitor-agent --server "$SERVER" --interval "$INTERVAL"' >> /app/entrypoint.sh && \
|
||||
echo 'else' >> /app/entrypoint.sh && \
|
||||
echo ' exec ./nerd-monitor-agent --server "$SERVER" --interval "$INTERVAL" --id "$AGENT_ID"' >> /app/entrypoint.sh && \
|
||||
echo 'fi' >> /app/entrypoint.sh && \
|
||||
chmod +x /app/entrypoint.sh
|
||||
|
||||
# Create non-root user
|
||||
RUN addgroup -D appgroup && adduser -D appuser -G appgroup
|
||||
USER appuser
|
||||
|
||||
# Create entrypoint script to handle environment variables
|
||||
RUN echo '#!/bin/sh\n\
|
||||
SERVER=${SERVER:-localhost:8080}\n\
|
||||
INTERVAL=${INTERVAL:-15s}\n\
|
||||
AGENT_ID=${AGENT_ID:-}\n\
|
||||
if [ -z "$AGENT_ID" ]; then\n\
|
||||
exec ./nerd-monitor-agent --server "$SERVER" --interval "$INTERVAL"\n\
|
||||
else\n\
|
||||
exec ./nerd-monitor-agent --server "$SERVER" --interval "$INTERVAL" --id "$AGENT_ID"\n\
|
||||
fi\n\
|
||||
' > /app/entrypoint.sh && chmod +x /app/entrypoint.sh
|
||||
|
||||
# Run the agent
|
||||
ENTRYPOINT ["/app/entrypoint.sh"]
|
||||
|
||||
Reference in New Issue
Block a user