Skip to content

Commit 5f98d5d

Browse files
committed
productionフォルダをたてた
1 parent 60bf8d2 commit 5f98d5d

File tree

3 files changed

+42
-16
lines changed

3 files changed

+42
-16
lines changed

docker/akane-next/Dockerfile

-16
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,3 @@ COPY --chown=node:node . .
4848
COPY --from=base --chown=node:node /app/node_modules ./node_modules
4949

5050
RUN npm run build
51-
52-
#
53-
# 本番環境向け
54-
#
55-
FROM base AS production
56-
57-
USER node
58-
WORKDIR /app
59-
60-
COPY --chown=node:node --from=build /app/.next ./.next
61-
COPY --chown=node:node --from=build /app/public ./public
62-
COPY --chown=node:node --from=build /app/next.config.ts ./next.config.ts
63-
COPY --chown=node:node --from=build /app/package.json ./package.json
64-
COPY --chown=node:node --from=build /app/node_modules ./node_modules
65-
66-
CMD ["npm", "start"]
+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
FROM node:22 AS base
2+
3+
# Next.js はビルド時に環境変数を参照しているので、
4+
# 環境変数をビルド時の引数として指定することで環境を切り分ける
5+
ARG NODE_ENV=""
6+
ARG DATABASE_URL=""
7+
ARG TZ="Asia/Tokyo"
8+
ARG MAPBOX_MAP_STYLE=""
9+
ARG MAPBOX_ACCESS_TOKEN=""
10+
11+
ENV NODE_ENV=${NODE_ENV}
12+
ENV DATABASE_URL=${DATABASE_URL}
13+
ENV TZ=${TZ}
14+
ENV NEXT_PUBLIC_MAPBOX_MAP_STYLE=${MAPBOX_MAP_STYLE}
15+
ENV NEXT_PUBLIC_MAPBOX_ACCESS_TOKEN=${MAPBOX_ACCESS_TOKEN}
16+
17+
USER node
18+
WORKDIR /app
19+
20+
COPY --chown=node:node package.json package-lock.json ./
21+
22+
RUN npm ci
23+
24+
#
25+
# 本番環境向け
26+
#
27+
FROM base AS production
28+
29+
USER node
30+
WORKDIR /app
31+
32+
COPY --chown=node:node --from=build /app/.next ./.next
33+
COPY --chown=node:node --from=build /app/public ./public
34+
COPY --chown=node:node --from=build /app/next.config.ts ./next.config.ts
35+
COPY --chown=node:node --from=build /app/package.json ./package.json
36+
COPY --chown=node:node --from=build /app/node_modules ./node_modules
37+
38+
CMD ["npm", "start"]

docker/production/nginx/conf.d/admin-st-akane.yaken.org.conf

+4
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,8 @@ server {
66
proxy_pass http://akane-next:3000/admin;
77
}
88

9+
location /_next {
10+
proxy_pass http://akane-next:3000;
11+
}
12+
913
}

0 commit comments

Comments
 (0)