Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,19 @@ WORKDIR /app
COPY . .

RUN go mod tidy
RUN CGO_ENABLED=0 GOOS=linux go build -o /main ./cmd/api
# -s -w drops debug symbols; the static binary needs nothing else at runtime.
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o /main ./cmd/api

# Final stage
FROM golang:1.24.4-alpine
# Final stage: plain Alpine instead of the Go toolchain image. It keeps a
# shell for the compose files that start the binary with `sh -c`.
FROM alpine:3.22

WORKDIR /
RUN adduser -D -H -u 10001 app

COPY --from=builder /main /main

USER app

EXPOSE 8000

CMD ["/main"]
CMD ["/main"]
5 changes: 5 additions & 0 deletions frontend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Installed and built inside the image; host copies would overwrite them.
node_modules
.next
.env*.local
npm-debug.log*
26 changes: 16 additions & 10 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Build stage
FROM node:18-alpine AS builder
FROM node:22-alpine AS builder

WORKDIR /app
ENV NEXT_TELEMETRY_DISABLED=1

COPY package.json ./
RUN npm install
COPY package.json package-lock.json ./
RUN npm ci

COPY . .

Expand All @@ -16,16 +17,21 @@ RUN if [ -n "$NEXT_PUBLIC_LIVEKIT_WS_URL" ]; then echo "NEXT_PUBLIC_LIVEKIT_WS_U
&& if [ -n "$NEXT_PUBLIC_APP_URL" ]; then echo "NEXT_PUBLIC_APP_URL=$NEXT_PUBLIC_APP_URL" >> .env.production.local; fi \
&& npm run build

# Final stage
FROM node:18-alpine
# Final stage: only Next.js' standalone server with the dependencies it
# traced, plus static assets. No build cache or dev dependencies.
FROM node:22-alpine

WORKDIR /app
ENV NODE_ENV=production \
PORT=3000 \
HOSTNAME=0.0.0.0

COPY --from=builder /app/.next ./.next
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/public ./public
COPY --from=builder --chown=node:node /app/.next/standalone ./
COPY --from=builder --chown=node:node /app/.next/static ./.next/static
COPY --from=builder --chown=node:node /app/public ./public

USER node

EXPOSE 3000

CMD ["npm", "start"]
CMD ["node", "server.js"]
2 changes: 2 additions & 0 deletions frontend/next.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
// Docker imajı yalnızca .next/standalone içindeki sunucuyu ve ihtiyaç duyduğu paketleri taşır.
output: 'standalone',
async rewrites() {
return [
{
Expand Down
Loading