# Google Cloud Function ## Installation ```bash= curl https://sdk.cloud.google.com | zsh export PATH=$PATH:{PATH}/google-cloud-sdk/bin ``` ## Initialize ```bash= gcloud init ``` ## Create a Project ## Create a Dockerfile > Note : please change the file name `dockerfile` to `Dockerfile`, this is important that Google Cloud Function use `Dockerfile`. > `ERROR: (gcloud.run.deploy) Invalid value for [source]: Dockerfile required when specifying --tag` > The port Google Cloud Function is using `8080` ```dockerfile FROM node:18-alpine WORKDIR /usr/src/app COPY package*.json ./ RUN npm install COPY . ./ # EXPOSE 8081 CMD ["npm", "start"] # CMD ["node", "index.js"] ``` ## Deploy ```bash gcloud run deploy --source . ``` [Note](https://medium.com/bryanyang0528/gcp-app-%E5%88%9D%E5%BF%83%E8%80%85-deploy-%E5%B0%88%E6%A1%88-5fadca557fd)