Files
blinko-cloudron/Dockerfile

78 lines
2.4 KiB
Docker

FROM cloudron/base:5.0.0
# Install Bun for building
RUN curl -fsSL https://bun.sh/install | bash
ENV PATH="/root/.bun/bin:${PATH}"
# Set up working directory
WORKDIR /app/code
# Clone Blinko repository
ARG BLINKO_VERSION=main
RUN git clone --depth 1 --branch ${BLINKO_VERSION} https://github.com/blinkospace/blinko.git /tmp/blinko
# Build the application
WORKDIR /tmp/blinko
# Install dependencies with Bun
RUN bun install --frozen-lockfile
# Handle Sharp for native image processing
RUN ARCH=$(uname -m) && \
if [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "arm64" ]; then \
bun add sharp@0.34.1 --arch=arm64 --platform=linux; \
fi
# Generate Prisma client
RUN bunx prisma generate
# Build the application
RUN bun run build:web
RUN bun run build:seed
# Copy built application to /app/code
WORKDIR /app/code
RUN cp -r /tmp/blinko/dist /app/code/dist && \
cp -r /tmp/blinko/server /app/code/server && \
cp -r /tmp/blinko/prisma /app/code/prisma && \
cp -r /tmp/blinko/node_modules /app/code/node_modules && \
cp /tmp/blinko/package.json /app/code/package.json
# Copy public assets if they exist
RUN if [ -d /tmp/blinko/public ]; then cp -r /tmp/blinko/public /app/code/public; fi
# Regenerate Prisma client for the runtime environment (cloudron base uses OpenSSL 3.0)
RUN cd /app/code && npx prisma generate --schema=/app/code/prisma/schema.prisma
# Copy Prisma engine to locations where the bundled code expects it
RUN cp /app/code/node_modules/.prisma/client/*.node /app/code/dist/ 2>/dev/null || true
RUN cp /app/code/node_modules/.prisma/client/*.node /app/code/node_modules/@prisma/client/ 2>/dev/null || true
# Link static files to where vite-express expects them
RUN ln -sfn /app/code/dist/public /app/code/server/public
# Set up initial data directory template
RUN mkdir -p /tmp/data/.blinko
# Install dumb-init
RUN ARCH=$(uname -m) && \
if [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "arm64" ]; then \
DUMB_INIT_ARCH="aarch64"; \
else \
DUMB_INIT_ARCH="x86_64"; \
fi && \
curl -Lo /usr/local/bin/dumb-init "https://github.com/Yelp/dumb-init/releases/download/v1.2.5/dumb-init_1.2.5_${DUMB_INIT_ARCH}" && \
chmod +x /usr/local/bin/dumb-init
# Clean up
RUN rm -rf /tmp/blinko
# Copy Cloudron configuration files
COPY start.sh /app/code/start.sh
COPY nginx.conf /app/code/nginx.conf
COPY supervisor/ /app/code/supervisor/
RUN chmod +x /app/code/start.sh
CMD ["/app/code/start.sh"]