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
|
# Remove storage directory and create symlink to /app/data/storage
|
||||||
RUN rm -rf /app/code/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 configuration files
|
||||||
COPY nginx.conf /etc/nginx/sites-available/default
|
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"
|
echo "==> Configuring application environment"
|
||||||
cat > /app/data/.env <<EOF
|
cat > /app/data/.env <<EOF
|
||||||
APP_NAME="AnonAddy"
|
APP_NAME="AnonAddy"
|
||||||
|
APP_KEY=
|
||||||
APP_ENV=production
|
APP_ENV=production
|
||||||
APP_DEBUG=false
|
APP_DEBUG=false
|
||||||
APP_URL=${CLOUDRON_APP_ORIGIN}
|
APP_URL=${CLOUDRON_APP_ORIGIN}
|
||||||
@@ -69,9 +70,9 @@ LOG_LEVEL=info
|
|||||||
BCRYPT_ROUNDS=12
|
BCRYPT_ROUNDS=12
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Create symlink for .env in /run (writable location)
|
# Set proper ownership
|
||||||
ln -sf /app/data/.env /run/.env
|
chown cloudron:cloudron /app/data/.env
|
||||||
ln -sf /app/data/.env /app/code/.env 2>/dev/null || true
|
chmod 640 /app/data/.env
|
||||||
|
|
||||||
# Generate APP_KEY if it doesn't exist
|
# Generate APP_KEY if it doesn't exist
|
||||||
if [ ! -f "/app/data/app_key" ]; then
|
if [ ! -f "/app/data/app_key" ]; then
|
||||||
@@ -98,10 +99,6 @@ else
|
|||||||
echo "ANONADDY_SECRET=${ANONADDY_SECRET}" >> /app/data/.env
|
echo "ANONADDY_SECRET=${ANONADDY_SECRET}" >> /app/data/.env
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set proper ownership
|
|
||||||
chown cloudron:cloudron /app/data/.env
|
|
||||||
chmod 640 /app/data/.env
|
|
||||||
|
|
||||||
# Run database migrations
|
# Run database migrations
|
||||||
echo "==> Running database migrations"
|
echo "==> Running database migrations"
|
||||||
cd /app/code
|
cd /app/code
|
||||||
|
|||||||
Reference in New Issue
Block a user