Skip to content

Instantly share code, notes, and snippets.

@renanlopescoder
Last active November 16, 2019 16:01
Show Gist options
  • Save renanlopescoder/c403ae9f6e00ef480c1ab03adae4c28b to your computer and use it in GitHub Desktop.
Save renanlopescoder/c403ae9f6e00ef480c1ab03adae4c28b to your computer and use it in GitHub Desktop.
Google Cloud Platform CI/CD
steps:
# build the container image
- name: "gcr.io/cloud-builders/docker"
args: ["build", "-t", "gcr.io/$PROJECT_ID/PROJECT_NAME:${SHORT_SHA}", "."]
# push the container image to Container Registry
- name: "gcr.io/cloud-builders/docker"
args: ["push", "gcr.io/$PROJECT_ID/PROJECT_NAME"]
# deploy container image to Cloud Run
- name: "gcr.io/cloud-builders/gcloud"
args:
[
"beta",
"run",
"deploy",
"PROJECT_NAME",
"--image",
"gcr.io/$PROJECT_ID/PROJECT_NAME:${SHORT_SHA}",
"--region",
"us-central1",
"--allow-unauthenticated",
"--platform",
"managed",
]
env:
- "PORT=8080"
images:
- gcr.io/$PROJECT_ID/PROJECT_NAME
# Dockerfile create-react-app
FROM node:10
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
ENV PORT 8080
ENV HOST 0.0.0.0
COPY package.json .
RUN npm install
COPY . ./
# Install dependencies
RUN npm install -g serve
RUN npm install --only=production
RUN npm run build
# Start the service
CMD serve -s build
# Dockerfile node
FROM node:10
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
ENV PORT 8080
ENV HOST 0.0.0.0
COPY package.json .
RUN npm install
COPY . ./
# Start server
CMD npm start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment