Skip to content

Commit

Permalink
chore: migrate frontend Dockerfile using bun
Browse files Browse the repository at this point in the history
  • Loading branch information
tructn committed Sep 30, 2024
1 parent d6dc13b commit c1b5098
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 20 deletions.
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
context: .
dockerfile: Dockerfile
environment:
- DB=postgres://postgres:admin@db:5432/racket?sslmode=disable
- DB=postgres://postgres:admin@db:5433/racket?sslmode=disable
- AUTH0_DOMAIN=
- AUTH0_CLIENTID=
- AUTH0_CLIENTSECRET=
Expand All @@ -31,7 +31,7 @@ services:
- POSTGRES_PASSWORD=admin
- POSTGRES_DB=racket
ports:
- "5432:5432"
- "5433:5432"
volumes:
- ./scripts/init.sql:/docker-entrypoint-initdb.d/init.sql
- pgdata:/var/lib/postgresql/data
Expand Down
33 changes: 15 additions & 18 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,35 +1,32 @@
# Stage 1: Build the React app
FROM node:18-alpine AS build
# Stage 1: Build the application
FROM oven/bun:latest as build

# Install pnpm
RUN npm i -g pnpm

# Set working directory
# Set the working directory
WORKDIR /app

# Copy package.json and pnpm-lock.yaml
COPY package.json pnpm-lock.yaml ./
# Copy the package.json and bun.lockb to install dependencies
COPY package.json bun.lockb ./

# Install dependencies
RUN pnpm install
# Install dependencies using Bun
RUN bun install

# Copy the rest of the application
# Copy the rest of the application code
COPY . .

# Build the application
RUN pnpm run build
# Build the Vite React application
RUN bun run build

# Stage 2: Serve the React app using nginx
FROM nginx:stable-alpine
# Stage 2: Serve with Nginx
FROM nginx:alpine

# Copy the built files from the previous stage
# Copy the build output to Nginx's default static serving directory
COPY --from=build /app/dist /usr/share/nginx/html

# Copy custom nginx configuration if needed
# Copy custom Nginx configuration if you have one (optional)
# COPY nginx.conf /etc/nginx/nginx.conf

# Expose port 80
EXPOSE 80

# Start nginx server
# Start Nginx
CMD ["nginx", "-g", "daemon off;"]

0 comments on commit c1b5098

Please sign in to comment.