File tree 3 files changed +60
-0
lines changed
3 files changed +60
-0
lines changed Original file line number Diff line number Diff line change
1
+ FROM node:alpine AS deps
2
+ # Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
3
+ RUN apk add --no-cache libc6-compat
4
+ WORKDIR /app
5
+ COPY package.json yarn.lock ./
6
+ RUN yarn install --frozen-lockfile
7
+
8
+ # Rebuild the source code only when needed
9
+ FROM node:alpine AS builder
10
+ ENV NODE_ENV production
11
+ WORKDIR /app
12
+ COPY . .
13
+ COPY --from=deps /app/node_modules ./node_modules
14
+ RUN yarn build
15
+
16
+ FROM gcr.io/distroless/nodejs
17
+ WORKDIR /app
18
+ ENV NODE_ENV production
19
+ # You only need to copy next.config.js if you are NOT using the default configuration
20
+ COPY --from=builder /app/next.config.js ./
21
+ COPY --from=builder /app/public ./public
22
+ COPY --from=builder /app/.next ./.next
23
+ COPY --from=builder /app/node_modules ./node_modules
24
+ COPY --from=builder /app/server.js ./server.js
25
+
26
+ EXPOSE 3000
27
+
28
+ CMD ["server.js" ]
29
+
30
+
31
+ # https://nextjs.org/docs/deployment#docker-image
32
+ # https://github.com/GoogleContainerTools/distroless#docker
Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ services:
12
12
- ../src:/app/src
13
13
- ../styles:/app/styles
14
14
- ../utils:/app/utils
15
+ environment :
16
+ - TZ=Asia/Tokyo
15
17
ports :
16
18
- 3000:3000
17
19
networks :
@@ -40,6 +42,7 @@ services:
40
42
- DB_PORT=3306
41
43
- DB_ROOT_PASSWORD=testpass
42
44
- GOOGLE_APPLICATION_CREDENTIALS=firebaseCredentials.json
45
+ - TZ=Asia/Tokyo
43
46
volumes :
44
47
- ../firebaseCredentials.json:/firebaseCredentials.json
45
48
ports :
Original file line number Diff line number Diff line change
1
+ name : CD
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - main
7
+
8
+ jobs :
9
+ gcr-push :
10
+ runs-on : ubuntu-latest
11
+ steps :
12
+ - name : Checkout repository
13
+ uses : actions/checkout@v2
14
+ - name : GCP Authenticate
15
+ uses : google-github-actions/setup-gcloud@master
16
+ with :
17
+ project_id : ${{ secrets.GCP_PROJECT_ID }}
18
+ service_account_key : ${{ secrets.GCP_SA_KEY }}
19
+ export_default_credentials : true
20
+ - name : Configure docker
21
+ run : gcloud auth configure-docker --quiet
22
+ - name : Build
23
+ run : docker build -t asia.gcr.io/${{ secrets.GCP_PROJECT_ID }}/frontend:$GITHUB_SHA -t asia.gcr.io/${{ secrets.GCP_PROJECT_ID }}/frontend:latest -f ./.docker/Dockerfile.prod .
24
+ - name : Push
25
+ run : docker push asia.gcr.io/${{ secrets.GCP_PROJECT_ID }}/frontend --all-tags
You can’t perform that action at this time.
0 commit comments