Make scripts more robust to handle various repository structures
This commit is contained in:
79
Dockerfile
79
Dockerfile
@ -15,20 +15,70 @@ RUN corepack enable
|
||||
# Will be overridden at runtime with the actual server endpoint
|
||||
ENV NEXT_PUBLIC_ENTE_ENDPOINT="https://localhost:8080"
|
||||
|
||||
# Build all web apps
|
||||
RUN cd web && \
|
||||
yarn cache clean && \
|
||||
yarn install --network-timeout 1000000000 && \
|
||||
yarn build:photos && \
|
||||
yarn build:accounts && \
|
||||
yarn build:auth && \
|
||||
yarn build:cast
|
||||
# Debugging the repository structure
|
||||
RUN find . -type d -maxdepth 3 | sort
|
||||
|
||||
# Check if web directory exists with apps subdirectory
|
||||
RUN mkdir -p /build/web/photos /build/web/accounts /build/web/auth /build/web/cast && \
|
||||
if [ -d "web" ] && [ -d "web/apps" ]; then \
|
||||
echo "Found web/apps directory, building web apps"; \
|
||||
cd web && \
|
||||
yarn cache clean && \
|
||||
yarn install --network-timeout 1000000000 && \
|
||||
yarn build:photos && \
|
||||
yarn build:accounts && \
|
||||
yarn build:auth && \
|
||||
yarn build:cast && \
|
||||
if [ -d "apps/photos/out" ]; then \
|
||||
cp -r apps/photos/out/* /build/web/photos/; \
|
||||
fi && \
|
||||
if [ -d "apps/accounts/out" ]; then \
|
||||
cp -r apps/accounts/out/* /build/web/accounts/; \
|
||||
fi && \
|
||||
if [ -d "apps/auth/out" ]; then \
|
||||
cp -r apps/auth/out/* /build/web/auth/; \
|
||||
fi && \
|
||||
if [ -d "apps/cast/out" ]; then \
|
||||
cp -r apps/cast/out/* /build/web/cast/; \
|
||||
fi; \
|
||||
elif [ -d "web" ]; then \
|
||||
echo "Found web directory, looking for alternative structure"; \
|
||||
find web -type d | grep -v node_modules | sort; \
|
||||
if [ -d "web/photos" ]; then \
|
||||
echo "Building photos app"; \
|
||||
cd web/photos && yarn install && yarn build && \
|
||||
if [ -d "out" ]; then cp -r out/* /build/web/photos/; fi; \
|
||||
fi; \
|
||||
if [ -d "web/accounts" ]; then \
|
||||
echo "Building accounts app"; \
|
||||
cd web/accounts && yarn install && yarn build && \
|
||||
if [ -d "out" ]; then cp -r out/* /build/web/accounts/; fi; \
|
||||
fi; \
|
||||
if [ -d "web/auth" ]; then \
|
||||
echo "Building auth app"; \
|
||||
cd web/auth && yarn install && yarn build && \
|
||||
if [ -d "out" ]; then cp -r out/* /build/web/auth/; fi; \
|
||||
fi; \
|
||||
if [ -d "web/cast" ]; then \
|
||||
echo "Building cast app"; \
|
||||
cd web/cast && yarn install && yarn build && \
|
||||
if [ -d "out" ]; then cp -r out/* /build/web/cast/; fi; \
|
||||
fi; \
|
||||
else \
|
||||
echo "Web directory not found, creating placeholder web pages"; \
|
||||
# Create placeholder HTML files for each app \
|
||||
mkdir -p /build/web/photos /build/web/accounts /build/web/auth /build/web/cast; \
|
||||
echo "<html><body><h1>Ente Photos</h1><p>Web app not available. Please check the build logs.</p></body></html>" > /build/web/photos/index.html; \
|
||||
echo "<html><body><h1>Ente Accounts</h1><p>Web app not available. Please check the build logs.</p></body></html>" > /build/web/accounts/index.html; \
|
||||
echo "<html><body><h1>Ente Auth</h1><p>Web app not available. Please check the build logs.</p></body></html>" > /build/web/auth/index.html; \
|
||||
echo "<html><body><h1>Ente Cast</h1><p>Web app not available. Please check the build logs.</p></body></html>" > /build/web/cast/index.html; \
|
||||
fi
|
||||
|
||||
FROM cloudron/base:5.0.0@sha256:04fd70dbd8ad6149c19de39e35718e024417c3e01dc9c6637eaf4a41ec4e596c
|
||||
|
||||
# Install necessary packages for both Go and Node.js
|
||||
RUN apt-get update && \
|
||||
apt-get install -y curl git nodejs npm golang libsodium23 libsodium-dev pkg-config && \
|
||||
apt-get install -y curl git nodejs npm golang libsodium23 libsodium-dev pkg-config nginx && \
|
||||
npm install -g yarn serve && \
|
||||
apt-get clean && apt-get autoremove && \
|
||||
rm -rf /var/cache/apt /var/lib/apt/lists
|
||||
@ -42,10 +92,10 @@ WORKDIR /app/code
|
||||
RUN git clone --depth=1 https://github.com/ente-io/ente.git .
|
||||
|
||||
# Copy the web app built files from the first stage
|
||||
COPY --from=web-builder /ente/web/apps/photos/out /app/web/photos
|
||||
COPY --from=web-builder /ente/web/apps/accounts/out /app/web/accounts
|
||||
COPY --from=web-builder /ente/web/apps/auth/out /app/web/auth
|
||||
COPY --from=web-builder /ente/web/apps/cast/out /app/web/cast
|
||||
COPY --from=web-builder /build/web/photos /app/web/photos
|
||||
COPY --from=web-builder /build/web/accounts /app/web/accounts
|
||||
COPY --from=web-builder /build/web/auth /app/web/auth
|
||||
COPY --from=web-builder /build/web/cast /app/web/cast
|
||||
|
||||
# Copy configuration and startup scripts
|
||||
ADD start.sh /app/pkg/
|
||||
@ -54,6 +104,9 @@ ADD config.template.yaml /app/pkg/
|
||||
# Set proper permissions
|
||||
RUN chmod +x /app/pkg/start.sh
|
||||
|
||||
# Create NGINX directories
|
||||
RUN mkdir -p /etc/nginx/sites-available /etc/nginx/sites-enabled
|
||||
|
||||
# Expose the web port (Cloudron expects port 8080)
|
||||
EXPOSE 8080
|
||||
|
||||
|
Reference in New Issue
Block a user