47 lines
No EOL
1.1 KiB
Docker
47 lines
No EOL
1.1 KiB
Docker
# Build stage
|
|
FROM oven/bun:latest as build
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy package.json and bun.lock
|
|
COPY package.json bun.lock ./
|
|
|
|
# Install dependencies
|
|
RUN bun install
|
|
|
|
# Copy the rest of the app
|
|
COPY . .
|
|
|
|
# Build the app
|
|
RUN bun run build
|
|
|
|
# Production stage
|
|
FROM nginx:alpine
|
|
|
|
# Copy custom nginx config if needed
|
|
# COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
# Copy the build output
|
|
COPY --from=build /app/dist/browser /usr/share/nginx/html
|
|
|
|
# Copy the env.js file
|
|
COPY --from=build /app/env.js /usr/share/nginx/html/env.js
|
|
|
|
# Copy the entrypoint script
|
|
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
|
RUN chmod +x /docker-entrypoint.sh
|
|
|
|
# Install envsubst
|
|
RUN apk add --no-cache gettext
|
|
|
|
# Update index.html to load env.js before the app
|
|
RUN sed -i 's/<head>/<head><script src="env.js"><\/script>/' /usr/share/nginx/html/index.html
|
|
|
|
# Set environment variables (these are defaults and can be overridden at runtime)
|
|
ENV STRIPE_KEY="pk_test_51QrePYIvCfqz7ANgMizBorPpVjJ8S6gcaL4yvcMQnVaKyReqcQ6jqaQEF7aDZbDu8rNVsTZrw8ABek4ToxQX7KZe00jpGh8naG"
|
|
ENV API_URL="/backend"
|
|
|
|
EXPOSE 80
|
|
|
|
# Use custom entrypoint to replace env vars at runtime
|
|
ENTRYPOINT ["/docker-entrypoint.sh"] |