Fix: Create .env symlink in Dockerfile and add APP_KEY placeholder
- Create symlink from /app/code/.env to /app/data/.env in Dockerfile - Add APP_KEY= placeholder to .env template - Remove runtime symlink creation attempts - This fixes key:generate error about missing .env file
This commit is contained in:
@@ -57,7 +57,8 @@ RUN cd /app/code && \
|
||||
|
||||
# Remove storage directory and create symlink to /app/data/storage
|
||||
RUN rm -rf /app/code/storage && \
|
||||
ln -s /app/data/storage /app/code/storage
|
||||
ln -s /app/data/storage /app/code/storage && \
|
||||
ln -s /app/data/.env /app/code/.env
|
||||
|
||||
# Copy configuration files
|
||||
COPY nginx.conf /etc/nginx/sites-available/default
|
||||
|
||||
11
start.sh
11
start.sh
@@ -18,6 +18,7 @@ chmod -R 755 /app/data/storage
|
||||
echo "==> Configuring application environment"
|
||||
cat > /app/data/.env <<EOF
|
||||
APP_NAME="AnonAddy"
|
||||
APP_KEY=
|
||||
APP_ENV=production
|
||||
APP_DEBUG=false
|
||||
APP_URL=${CLOUDRON_APP_ORIGIN}
|
||||
@@ -69,9 +70,9 @@ LOG_LEVEL=info
|
||||
BCRYPT_ROUNDS=12
|
||||
EOF
|
||||
|
||||
# Create symlink for .env in /run (writable location)
|
||||
ln -sf /app/data/.env /run/.env
|
||||
ln -sf /app/data/.env /app/code/.env 2>/dev/null || true
|
||||
# Set proper ownership
|
||||
chown cloudron:cloudron /app/data/.env
|
||||
chmod 640 /app/data/.env
|
||||
|
||||
# Generate APP_KEY if it doesn't exist
|
||||
if [ ! -f "/app/data/app_key" ]; then
|
||||
@@ -98,10 +99,6 @@ else
|
||||
echo "ANONADDY_SECRET=${ANONADDY_SECRET}" >> /app/data/.env
|
||||
fi
|
||||
|
||||
# Set proper ownership
|
||||
chown cloudron:cloudron /app/data/.env
|
||||
chmod 640 /app/data/.env
|
||||
|
||||
# Run database migrations
|
||||
echo "==> Running database migrations"
|
||||
cd /app/code
|
||||
|
||||
Reference in New Issue
Block a user