feat(apisix): update Dockerfile and start.sh for local testing; add LEARNING.md\n\n- Dockerfile updated to correctly handle user permissions and file copying.\n- start.sh updated for better logging and etcd configuration.\n- Added LEARNING.md to track development insights and mistakes.\n\n🤖 Generated with Gemini CLI\nCo-Authored-By: Gemini <noreply@google.com>

This commit is contained in:
2025-09-04 11:26:44 -05:00
parent 419322a095
commit 879fddcb9a
5 changed files with 70 additions and 15 deletions

View File

@@ -1,18 +1,19 @@
FROM apache/apisix:3.6.0-debian
# Switch to root user for package installation and setup
USER root
# Install additional tools needed for Cloudron
RUN apt-get update && apt-get install -y \
curl \
wget \
--no-install-recommends && \
rm -rf /var/lib/apt/lists/*
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y curl wget sudo --no-install-recommends && rm -rf /var/lib/apt/lists/*
# Set up directory structure following Cloudron conventions
RUN mkdir -p /app/code /app/data
# Copy APISIX to Cloudron app directory
RUN cp -r /usr/local/apisix/* /app/code/ && \
cp -r /usr/bin/apisix /app/code/
RUN cp -r /usr/local/apisix/. /app/code/ && \
mkdir -p /app/code/bin && \
cp /usr/bin/apisix /app/code/bin/
# Copy configuration template
COPY config.yaml /app/code/conf/config.yaml
@@ -22,14 +23,13 @@ COPY start.sh /app/code/start.sh
RUN chmod +x /app/code/start.sh
# Set proper permissions
RUN chown -R cloudron:cloudron /app/code /app/data
RUN groupadd -r cloudron && useradd -r -g cloudron cloudron && chown -R cloudron:cloudron /app/code /app/data
# Configure working directory and user
# Configure working directory
WORKDIR /app/code
USER cloudron
# Expose ports
EXPOSE 9080 9443
# Start the application
CMD ["/app/code/start.sh"]
# Start the application as cloudron user
CMD ["/usr/bin/sudo", "-E", "-u", "cloudron", "/app/code/start.sh"]

View File

@@ -0,0 +1 @@
# This is a placeholder config.yaml. It will be overwritten by start.sh

View File

@@ -30,6 +30,10 @@ deployment:
EOF
# Print generated config.yaml and environment variables for debugging
cat /app/data/conf/config.yaml >> "${LOG_FILE}" 2>&1
env >> "${LOG_FILE}" 2>&1
# Set APISIX_CONF_FILE environment variable
export APISIX_CONF_FILE=/app/data/conf/config.yaml