Last active
January 19, 2021 20:09
-
-
Save ashmore11/fb525b5808b90233780aad14434fc600 to your computer and use it in GitHub Desktop.
Next Strapi Cloud Run (docker compose cloud sql proxy)
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
version: "3.7" | |
services: | |
next-strapi-cloud-run-cloud-sql-proxy: | |
container_name: next-strapi-cloud-run-cloud-sql-proxy | |
image: gcr.io/cloudsql-docker/gce-proxy:1.19.1 | |
command: /cloud_sql_proxy -instances={Cloud SQL connnection name}=tcp:0.0.0.0:3306 -credential_file=/credentials.json | |
volumes: | |
- ./google-credentials.json:/credentials.json | |
ports: | |
- 3308:3306 | |
next-strapi-cloud-run-cms: | |
image: strapi/strapi | |
container_name: next-strapi-cloud-run-cms | |
working_dir: /usr/src/cms | |
command: sh -c "npm i; npm run develop" | |
ports: | |
- "1337:1337" | |
depends_on: | |
- next-strapi-cloud-run-cloud-sql-proxy | |
volumes: | |
- ./cms:/usr/src/cms | |
- /usr/src/cms/node_modules | |
environment: | |
- NODE_ENV=development | |
- DB_HOST=next-strapi-cloud-run-cloud-sql-proxy | |
- DB_PORT=3306 | |
- DB_NAME=development | |
- DB_USERNAME=local | |
- DB_PASSWORD=$DB_PASSWORD | |
next-strapi-cloud-run-app: | |
image: node:12-alpine | |
container_name: next-strapi-cloud-run-app | |
working_dir: /usr/src/app | |
command: sh -c "npm i; npm run dev" | |
ports: | |
- "3000:3000" | |
depends_on: | |
- next-strapi-cloud-run-cms | |
volumes: | |
- ./app:/usr/src/app | |
- /usr/src/app/node_modules | |
- /usr/src/app/.next | |
environment: | |
- NODE_ENV=development | |
- CMS_GRAPHQL_URL=http://next-strapi-cloud-run-cms:1337/graphql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment