Skip to content

Commit 6391a32

Browse files
committed
fix: build frontend from root
1 parent ff45999 commit 6391a32

File tree

1 file changed

+7
-32
lines changed

1 file changed

+7
-32
lines changed

frontend.Dockerfile

Lines changed: 7 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,19 @@
1-
FROM oven/bun:1 AS builder
1+
FROM oven/bun:1 AS base
22
WORKDIR /app
33

4-
COPY package.json bun.lock ./
4+
COPY . .
55

6-
COPY apps/frontend ./apps/frontend
7-
8-
RUN bun install --frozen-lockfile
9-
10-
WORKDIR /app/apps/frontend
6+
RUN bun i
117
RUN bun run build
128

139
FROM nginx:alpine
10+
WORKDIR /usr/share/nginx/html
1411

1512
RUN rm /etc/nginx/conf.d/default.conf
1613

17-
RUN cat <<'EOF' > /etc/nginx/conf.d/default.conf
18-
server {
19-
listen 80;
20-
21-
location / {
22-
root /usr/share/nginx/html;
23-
index index.html;
24-
try_files $uri $uri/ /index.html;
25-
}
26-
27-
error_page 404 /404.html;
28-
location = /404.html {
29-
root /usr/share/nginx/html;
30-
internal;
31-
}
32-
33-
error_page 500 502 503 504 /50x.html;
34-
location = /50x.html {
35-
root /usr/share/nginx/html;
36-
internal;
37-
}
38-
}
39-
EOF
40-
41-
COPY --from=builder /app/apps/frontend/dist /usr/share/nginx/html
14+
RUN printf 'server {\n listen 80;\n\n location / {\n root /usr/share/nginx/html;\n index index.html;\n try_files $uri $uri/ /index.html;\n }\n\n error_page 404 /404.html;\n location = /404.html {\n root /usr/share/nginx/html;\n internal;\n }\n\n error_page 500 502 503 504 /50x.html;\n location = /50x.html {\n root /usr/share/nginx/html;\n internal;\n }\n}\n' > /etc/nginx/conf.d/default.conf
15+
16+
COPY --from=base /app/apps/frontend/dist .
4217

4318
EXPOSE 80
4419

0 commit comments

Comments
 (0)