File tree Expand file tree Collapse file tree 3 files changed +62
-1
lines changed
Expand file tree Collapse file tree 3 files changed +62
-1
lines changed Original file line number Diff line number Diff line change 1+ name : Build and deploy docker image
2+
3+ on : [push]
4+
5+ env :
6+ DATABASE_TYPE : postgresql
7+ SKIP_DB_CHECK : 1
8+ DATABASE_URL : postgresql://umami:umami@db:5432/umami
9+
10+ PROJECT_ID : cocoon-space-web
11+ SERVICE_NAME : cocoon-space-umami
12+ REGION : europe-west1
13+ REGISTRY : europe-west1-docker.pkg.dev
14+ REPOSITORY : cocoon-space
15+
16+ jobs :
17+ build :
18+ runs-on : ubuntu-latest
19+
20+ steps :
21+ - uses : actions/checkout@v4
22+
23+ - name : Authenticate to Google Cloud
24+ uses : google-github-actions/auth@v2
25+ with :
26+ credentials_json : ' ${{ secrets.RUN_SA_KEY }}'
27+
28+ - name : Set up Google Cloud SDK
29+ uses : google-github-actions/setup-gcloud@v2
30+
31+ - name : Configure Docker for GCP
32+ run : gcloud auth configure-docker ${{ env.REGISTRY }}
33+
34+ - name : Set up Docker Buildx
35+ uses : docker/setup-buildx-action@v3
36+
37+ - name : Build and push
38+ uses : docker/build-push-action@v6
39+ with :
40+ push : true
41+ build-args : |
42+ DATABASE_TYPE=postgresql
43+ tags : |
44+ ${{ env.REGISTRY }}/${{ env.PROJECT_ID }}/${{ env.REPOSITORY }}/${{ env.SERVICE_NAME }}:${{ github.sha }}
45+ ${{ env.REGISTRY }}/${{ env.PROJECT_ID }}/${{ env.REPOSITORY }}/${{ env.SERVICE_NAME }}:latest
46+ cache-from : type=registry,ref=${{ env.REGISTRY }}/${{ env.PROJECT_ID }}/${{ env.REPOSITORY }}/${{ env.SERVICE_NAME }}:latest
47+ cache-to : type=inline
48+
49+ - name : Show Output
50+ run : echo ${{ steps.deploy.outputs.url }}
Original file line number Diff line number Diff line change @@ -57,11 +57,14 @@ COPY --from=builder /app/generated ./generated
5757COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
5858COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
5959
60+ COPY run.sh /run.sh
61+ RUN chmod +x /run.sh
62+
6063USER nextjs
6164
6265EXPOSE 3000
6366
6467ENV HOSTNAME=0.0.0.0
6568ENV PORT=3000
6669
67- CMD ["pnpm" , "start-docker " ]
70+ CMD ["/run.sh " ]
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ if [ -z " $DATABASE_URL " ]; then
4+ DATABASE_URL=" postgresql://${DB_USER} :${DB_PASSWORD} @${DB_HOST} :${DB_PORT} /${DB_NAME} "
5+ export DATABASE_URL
6+ fi
7+
8+ pnpm start-docker
You can’t perform that action at this time.
0 commit comments