-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
57 lines (40 loc) · 1.3 KB
/
Dockerfile
File metadata and controls
57 lines (40 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Stage 1: Build the application using Bun
FROM oven/bun:latest AS build-stage
# Set working directory
WORKDIR /app
# Copy package.json and lock files
COPY package*.json bun.lockb ./
# Install dependencies using Bun
RUN bun install
# Copy all files
COPY . .
# Build the application
# Add build args for environment variables
ARG NUXT_PUBLIC_BLOG_URL
ENV NUXT_PUBLIC_BLOG_URL=${NUXT_PUBLIC_BLOG_URL}
ARG NUXT_BACKEND_API
ENV NUXT_BACKEND_API=${NUXT_BACKEND_API}
ARG NUXT_UMAMI_ID
ENV NUXT_UMAMI_ID=${NUXT_UMAMI_ID}
ARG NUXT_UMAMI_HOST
ENV NUXT_UMAMI_HOST=${NUXT_UMAMI_HOST}
RUN bun run build
# Stage 2: Serve the application using Bun
FROM oven/bun:latest AS production-stage
# Set working directory
WORKDIR /app
# Copy only the necessary files from the build stage
COPY --from=build-stage /app/.output /app/.output
COPY --from=build-stage /app/package*.json /app/bun.lockb ./
# Install only production dependencies using Bun
RUN bun install --production
# Expose the port the Nuxt app will run on
EXPOSE 3000
# Set environment variable for production
ENV NODE_ENV=production
ENV NUXT_PUBLIC_BLOG_URL=${NUXT_PUBLIC_BLOG_URL}
ENV NUXT_BACKEND_API=${NUXT_BACKEND_API}
ENV NUXT_UMAMI_ID=${NUXT_UMAMI_ID}
ENV NUXT_UMAMI_HOST=${NUXT_UMAMI_HOST}
# Command to run the app using Bun
CMD ["bun", ".output/server/index.mjs"]