bun + nginx Dockerfile

Bun — A fast all-in-one JavaScript runtime
Bundle, install, and run JavaScript & TypeScript — all in Bun. Bun is a new JavaScript runtime with a native bundler, transpiler, task runner, and npm client built-in.

bun을 이용하여, 기존 npm, yarn 대비 빠른 패키지 설치 및 빌드를 통해 배포를 하기 위한 메모이다.

FROM oven/bun:1 as builder

WORKDIR /app

COPY package*.json ./
RUN bun install

COPY . .
RUN bun run build

FROM nginx:stable-alpine
RUN rm -rf /etc/nginx/conf.d/default.conf
COPY --from=builder /app/nginx/default.conf /etc/nginx/conf.d/default.conf

RUN rm -rf /usr/share/nginx/html/*
COPY --from=builder /app/dist /usr/share/nginx/html

EXPOSE 80
ENTRYPOINT ["nginx", "-g", "daemon off;"]

Dockerfile

server {
  listen 80;
  location / {
    root   /usr/share/nginx/html;
    index  index.html index.htm;
    try_files $uri $uri/ /index.html;
  }
}

./nginx/default.conf

version: "3"
services:
  nw-frontend:
    container_name: nw-frontend
    build:
      context: .
      dockerfile: Dockerfile
    ports:
      - "80:80"

docker-compose.yml

You've successfully subscribed to taking
Great! Next, complete checkout to get full access to all premium content.
Error! Could not sign up. invalid link.
Welcome back! You've successfully signed in.
Error! Could not sign in. Please try again.
Success! Your account is fully activated, you now have access to all content.
Error! Stripe checkout failed.
Success! Your billing info is updated.
Error! Billing info update failed.