File tree Expand file tree Collapse file tree 2 files changed +56
-0
lines changed
Expand file tree Collapse file tree 2 files changed +56
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Build and Publish Docker Image
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+
8+ jobs :
9+ build :
10+ permissions :
11+ id-token : write # This is required for requesting the JWT
12+ runs-on : ubuntu-latest
13+
14+ steps :
15+ - name : Checkout code
16+ uses : actions/checkout@v3
17+
18+ - name : Set up Docker Buildx
19+ uses : docker/setup-buildx-action@v1
20+
21+ - name : configure aws credentials
22+ uses : aws-actions/configure-aws-credentials@v4
23+ with :
24+ role-to-assume : arn:aws:iam::654654236858:role/GithubActions
25+ role-session-name : GitHub_to_AWS_via_FederatedOIDC
26+ aws-region : us-east-2
27+
28+ - name : Login to Amazon ECR
29+ id : login-ecr
30+ uses : aws-actions/amazon-ecr-login@v2
31+
32+ - name : Build and Push Docker image
33+ env :
34+ ECR_REGISTRY : ${{ steps.login-ecr.outputs.registry}}
35+ REPOSITORY : nuxt-template
36+ IMAGE_TAG : ${{ github.sha}}
37+ DATABASE_URL : " file:./dev.db"
38+ run : |
39+ docker buildx build --output type=image,push=true --platform linux/arm64 -t $ECR_REGISTRY/$REPOSITORY:$IMAGE_TAG .
40+ docker buildx build --output type=image,push=true --platform linux/arm64 -t $ECR_REGISTRY/$REPOSITORY:prod .
Original file line number Diff line number Diff line change 1+ FROM node:22-alpine AS builder
2+ COPY . ./
3+
4+ ENV PNPM_HOME="/pnpm"
5+ ENV PATH="$PNPM_HOME:$PATH"
6+ RUN corepack enable
7+
8+ RUN pnpm i --force
9+ RUN npx prisma generate
10+ RUN pnpm run build
11+
12+ FROM node:22-alpine AS deployment
13+
14+ COPY --from=builder /.output /
15+ EXPOSE 3000
16+ CMD ["node", "./server/index.mjs"]
You can’t perform that action at this time.
0 commit comments