diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..585d7a3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,34 @@ +# ================================================ +FROM oven/bun AS build + +WORKDIR /app + +# Cache packages installation +COPY package.json package.json +COPY bun.lock bun.lock + +RUN bun install + +COPY ./src ./src + +ENV NODE_ENV=production + +RUN bun build \ + --compile \ + --minify-whitespace \ + --minify-syntax \ + --outfile server \ + src/index.ts + +# ================================================ +FROM gcr.io/distroless/base + +WORKDIR /app + +COPY --from=build /app/server server + +ENV NODE_ENV=production + +CMD ["./server"] + +EXPOSE 3000 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..9193a26 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,10 @@ +services: + server: + build: + context: . + dockerfile: Dockerfile + ports: + - "3000:3000" + volumes: + - ./data:/app/data + command: /app/server