-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.dev
More file actions
112 lines (88 loc) · 5.06 KB
/
Dockerfile.dev
File metadata and controls
112 lines (88 loc) · 5.06 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# ══════════════════════════════════════════════════════════════════════════════
# Stage 1 — Go + Air
# ══════════════════════════════════════════════════════════════════════════════
FROM golang:1.25-alpine AS go-builder
RUN apk add --no-cache gcc musl-dev
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
RUN go install github.com/air-verse/air@latest
COPY server/ ./server/
RUN mkdir -p /app/tmp && go build -o /app/tmp/aether-server ./server/
# ══════════════════════════════════════════════════════════════════════════════
# Stage 2 — Node.js / pnpm
# ══════════════════════════════════════════════════════════════════════════════
FROM node:25-alpine AS node-builder
WORKDIR /app/app
RUN npm install -g corepack --force && corepack enable && corepack prepare pnpm@9.15.4 --activate
COPY app/package.json app/pnpm-lock.yaml* ./
RUN pnpm install --ignore-scripts
# ══════════════════════════════════════════════════════════════════════════════
# Stage final
# ══════════════════════════════════════════════════════════════════════════════
FROM node:25-alpine
RUN apk add --no-cache \
ca-certificates \
tzdata \
curl \
bash \
git \
wget \
build-base \
libc6-compat \
docker-cli \
postgresql \
postgresql-client \
openssl
# ── Go (requis par Air pour recompiler à chaud) ───────────────────────────────
RUN ARCH=$(uname -m) && \
case "$ARCH" in \
x86_64) GOARCH="amd64" ;; \
aarch64) GOARCH="arm64" ;; \
*) echo "Unsupported arch: $ARCH" && exit 1 ;; \
esac && \
wget -q "https://go.dev/dl/go1.24.2.linux-${GOARCH}.tar.gz" -O /tmp/go.tar.gz \
&& tar -C /usr/local -xzf /tmp/go.tar.gz \
&& rm /tmp/go.tar.gz
ENV PATH="/usr/local/go/bin:/go/bin:/root/go/bin:/root/.local/share/corepack:/usr/local/bin:/usr/bin:/bin:${PATH}"
ENV GOPATH="/go"
ENV PATH="${PATH}:/root/.local/share/corepack"
# ── pnpm (requis pour lancer next dev) ───────────────────────────────────────
RUN npm install -g corepack --force && corepack enable && corepack prepare pnpm@9.15.4 --activate && \
ln -sf /root/.local/share/corepack/pnpm /usr/local/bin/pnpm
WORKDIR /app
# ── Binaires Go ───────────────────────────────────────────────────────────────
COPY --from=go-builder /go/bin/air /go/bin/air
COPY --from=go-builder /usr/local/go /usr/local/go
COPY --from=go-builder /app/server/ ./server/
COPY --from=go-builder /app/tmp/aether-server /app/tmp/aether-server
# ── node_modules au bon endroit : /app/app/node_modules ──────────────────────
COPY --from=node-builder /app/app/node_modules ./app/node_modules/
# ── Sources Next.js (écrasées par le volume mount en dev) ────────────────────
COPY app/package.json ./app/
COPY app/pnpm-lock.yaml ./app/
COPY app/tsconfig.json ./app/
COPY app/next.config.ts ./app/
COPY app/postcss.config.mjs ./app/
COPY app/components.json ./app/
COPY app/eslint.config.mjs ./app/
COPY app/middleware.ts ./app/
COPY app/app/ ./app/app/
COPY app/components/ ./app/components/
COPY app/config/ ./app/config/
COPY app/context/ ./app/context/
COPY app/hooks/ ./app/hooks/
COPY app/i18n/ ./app/i18n/
COPY app/lib/ ./app/lib/
COPY app/public/ ./app/public/
COPY app/styles/ ./app/styles/
COPY app/messages/ ./app/messages/
COPY server/prisma/ ./prisma/
COPY scripts/ ./app/scripts/
# ── Config dev ────────────────────────────────────────────────────────────────
COPY .air.toml ./
COPY .env.example ./.env
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
EXPOSE 3000
ENTRYPOINT ["/entrypoint.sh"]