-
Notifications
You must be signed in to change notification settings - Fork 0
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 #7 from claustra01/infra/docker
インフラ構築
- Loading branch information
Showing
8 changed files
with
96 additions
and
3 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
ACR_HOST= | ||
ACR_USER= | ||
ACR_PASSWORD= |
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 @@ | ||
.env.local |
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,18 @@ | ||
include .env.local | ||
|
||
.PHONY: up down push | ||
|
||
up: | ||
docker compose up -d --build | ||
|
||
down: | ||
docker-compose down | ||
|
||
push: | ||
docker login $(ACR_HOST) -u $(ACR_USER) -p $(ACR_PASSWORD) | ||
docker build -t bot ./bot | ||
docker build -t web ./web | ||
docker tag bot $(ACR_HOST)/bot:latest | ||
docker tag web $(ACR_HOST)/web:latest | ||
docker push $(ACR_HOST)/bot:latest | ||
docker push $(ACR_HOST)/web:latest |
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,23 @@ | ||
FROM golang:1.22-alpine AS build | ||
ENV TZ=Asia/Tokyo | ||
|
||
WORKDIR /opt/app | ||
|
||
COPY go.mod . | ||
COPY go.sum . | ||
RUN go mod download | ||
|
||
COPY . . | ||
RUN go build -o ./calendeye | ||
|
||
#------------------------------------------------------------ | ||
FROM gcr.io/distroless/base:nonroot AS runner | ||
ENV TZ=Asia/Tokyo | ||
ENV GOENV=production | ||
ENV PORT=80 | ||
|
||
COPY --from=build /opt/app/calendeye /bin/calendeye | ||
|
||
EXPOSE ${PORT} | ||
USER nonroot | ||
ENTRYPOINT [ "/bin/calendeye" ] |
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,20 @@ | ||
version: '3' | ||
services: | ||
|
||
bot: | ||
build: | ||
context: ./bot | ||
dockerfile: Dockerfile | ||
env_file: | ||
- ./bot/.env | ||
ports: | ||
- 5000:80 | ||
|
||
web: | ||
build: | ||
context: ./web | ||
dockerfile: Dockerfile | ||
env_file: | ||
- ./web/.env | ||
ports: | ||
- 5173:80 |
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,23 @@ | ||
FROM node:20-alpine AS build | ||
ENV TZ=Asia/Tokyo | ||
|
||
WORKDIR /opt/app | ||
|
||
COPY package.json . | ||
COPY package-lock.json . | ||
RUN npm install | ||
|
||
COPY . . | ||
RUN npm run build | ||
|
||
#------------------------------------------------------------ | ||
FROM nginx:latest | ||
ENV TZ=Asia/Tokyo | ||
|
||
WORKDIR /etc/nginx/html | ||
|
||
RUN rm -rf /usr/share/nginx/html/* | ||
COPY --from=build /opt/app/dist/ /usr/share/nginx/html/ | ||
|
||
EXPOSE 80 | ||
ENTRYPOINT ["nginx", "-g", "daemon off;"] |
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 |
---|---|---|
|
@@ -22,5 +22,8 @@ | |
"@vitejs/plugin-react": "4.2.1", | ||
"typescript": "5.4.3", | ||
"vite": "5.2.6" | ||
}, | ||
"volta": { | ||
"node": "20.12.0" | ||
} | ||
} |