-
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.
Merge pull request #792 from NUTFes/feat/kubosaka/791-docker-image-fix
imageの修正、デプロイのコマンド簡略化
- Loading branch information
Showing
7 changed files
with
98 additions
and
20 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
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,19 +1,16 @@ | ||
FROM golang:latest | ||
|
||
# Build用 コンテナ | ||
FROM golang:latest AS builder | ||
WORKDIR /app | ||
COPY . /app | ||
ENV CGO_ENABLED=0 \ | ||
GOOS=linux | ||
RUN go mod tidy | ||
RUN go build -o ./main ./main.go | ||
|
||
RUN apt-get update | ||
RUN apt-get upgrade -y | ||
RUN apt-get install -y locales \ | ||
&& locale-gen ja_JP.UTF-8 \ | ||
&& echo "export LANG=ja_JP.UTF-8" >> ~/.bashrc | ||
|
||
RUN export LANG=C.UTF-8 | ||
RUN export LANGUAGE=en_US: | ||
|
||
ENV CGO_ENABLED=0 | ||
ENV GOOS=linux | ||
#ENV GOARCH=amd64 | ||
|
||
|
||
# 本番用 軽量 Debian | ||
FROM gcr.io/distroless/base-debian11:nonroot AS runner | ||
LABEL org.opencontainers.image.source="https://github.com/NUTFes/FinanSu" | ||
COPY --from=builder --chown=nonroot /app/main . | ||
USER nonroot | ||
EXPOSE 1323 | ||
CMD ["./main"] |
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,51 @@ | ||
services: | ||
db: | ||
image: mysql:8.0 | ||
container_name: "nutfes-finansu-db" | ||
volumes: | ||
- ./mysql/db:/docker-entrypoint-initdb.d # 初期データ | ||
- ./my.cnf:/etc/mysql/conf.d/my.cnf | ||
environment: | ||
MYSQL_DATABASE: finansu_db | ||
MYSQL_USER: finansu | ||
MYSQL_PASSWORD: password | ||
MYSQL_ROOT_PASSWORD: root | ||
TZ: "Asia/Tokyo" | ||
ports: | ||
- "3306:3306" | ||
restart: always | ||
|
||
minio: | ||
image: minio/minio:latest | ||
ports: | ||
- "9000:9000" | ||
- "9001:9001" | ||
volumes: | ||
- ./tmp/minio/data:/data | ||
command: "server /data --console-address :9001" | ||
environment: | ||
MINIO_ROOT_USER: user | ||
MINIO_ROOT_PASSWORD: password | ||
|
||
view: | ||
build: | ||
context: ./view | ||
dockerfile: local-prod.Dockerfile | ||
container_name: "nutfes-finansu-view" | ||
command: "npm run start" | ||
ports: ["3000:3000"] | ||
depends_on: ["api"] | ||
|
||
api: | ||
build: | ||
context: ./api | ||
dockerfile: prod.Dockerfile | ||
container_name: "nutfes-finansu-api" | ||
env_file: ["./finansu.env"] | ||
ports: ["1323:1323"] | ||
environment: | ||
ENV: "develop" | ||
RESET_PASSWORD_URL: "https://finansu.nutfes.net/reset_password" | ||
depends_on: | ||
db: | ||
condition: service_started |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM node:20.14 | ||
WORKDIR /app/next-project | ||
COPY ./next-project /app/next-project | ||
|
||
ENV NODE_ENV production | ||
ENV NEXT_PUBLIC_APP_ENV develop | ||
|
||
RUN npm install --production | ||
RUN npm run build |
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,9 @@ | ||
FROM node:20.14 | ||
WORKDIR /app/next-project | ||
COPY ./next-project /app/next-project | ||
|
||
ENV NODE_ENV production | ||
ENV NEXT_PUBLIC_APP_ENV production | ||
|
||
RUN npm install --production | ||
RUN npm run build |