-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Docker周りのファイルを修正, Docker Imageの軽量化と不要なオプションを削除
- Loading branch information
1 parent
a33dd9a
commit cd082d4
Showing
8 changed files
with
56 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM python:3.10 | ||
FROM python:3.10-slim-bookworm | ||
|
||
WORKDIR /api | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
docker-compose -f docker-compose.prod.yml down | ||
docker compose -f docker-compose.prod.yml down |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,2 @@ | ||
docker-compose -f docker-compose.prod.yml build | ||
docker compose -f docker-compose.prod.yml run --rm view yarn | ||
docker compose -f docker-compose.prod.yml run --rm view yarn build | ||
docker compose -f docker-compose.prod.yml up -d | ||
docker compose -f docker-compose.prod.yml build | ||
docker compose -f docker-compose.prod.yml up -d view api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
FROM node:20.11.1-bookworm-slim AS base | ||
|
||
FROM base AS deps | ||
|
||
WORKDIR /app | ||
|
||
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./ | ||
RUN \ | ||
if [ -f yarn.lock ]; then yarn; \ | ||
elif [ -f package-lock.json ]; then npm ci; \ | ||
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i --frozen-lockfile; \ | ||
else echo "Lockfile not found." && exit 1; \ | ||
fi | ||
|
||
FROM base AS builder | ||
WORKDIR /app | ||
COPY --from=deps /app/node_modules ./node_modules | ||
COPY . . | ||
|
||
ENV NEXT_TELEMENTRY_DISABLED 1 | ||
|
||
RUN \ | ||
if [ -f yarn.lock ]; then yarn run build; \ | ||
else echo "Lockfile not found." && exit; \ | ||
fi | ||
|
||
FROM base AS runner | ||
WORKDIR /app | ||
|
||
ENV NDOE_ENV production | ||
|
||
ENV NEXT_TELEMENTRY_DISABLED 1 | ||
|
||
RUN addgroup --system --gid 1001 nodejs | ||
RUN adduser --system --uid 1001 nextjs | ||
|
||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ | ||
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static | ||
|
||
USER nextjs | ||
|
||
EXPOSE 3000 | ||
|
||
ENV PORT 3000 | ||
|
||
CMD HOSTNAME="0.0.0.0" node server.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
FROM node:20.11.1 | ||
FROM node:20.11.1-bookworm-slim | ||
|
||
WORKDIR /view | ||
COPY ./ /view | ||
|
||
RUN yarn set version stable | ||
RUN yarn install | ||
|
||
CMD sh -c "yarn && yarn dev" |