Last active
November 16, 2019 16:01
-
-
Save renanlopescoder/c403ae9f6e00ef480c1ab03adae4c28b to your computer and use it in GitHub Desktop.
Google Cloud Platform CI/CD
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
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 |
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
# 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 |
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
# 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