Skip to content
This repository has been archived by the owner on Jul 2, 2023. It is now read-only.

Commit

Permalink
[+] add : prod environment
Browse files Browse the repository at this point in the history
  • Loading branch information
aslupin committed Mar 23, 2021
1 parent e083bd5 commit 7d650e2
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/push-image-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: "Push Image (Production)"

on:
push:
branches:
- prod-release-image
jobs:
build:
name: Cloud Run Deployment
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master

- name: Setup GCP Service Account
uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
with:
version: "latest"
service_account_email: ${{ secrets.GCP_SA_EMAIL }}
service_account_key: ${{ secrets.GCP_SA_KEY }}
export_default_credentials: true

- name: Configure Docker
run: |
gcloud auth configure-docker
- name: Build
run: |
docker build -f ./docker/prod.Dockerfile . -t asia.gcr.io/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCR_IMAGE_NAME }}
- name: Push
run: |
docker push asia.gcr.io/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCR_IMAGE_NAME }}:latest
27 changes: 27 additions & 0 deletions docker/prod.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Building stage
FROM node:14.2 as builder
WORKDIR /usr/src/app

ARG GIT_ACCESS_TOKEN_CURL_CONFIG

COPY *.sh *.json *.js Makefile ./
COPY src src/
COPY config config/

RUN curl -o production.yml https://${GIT_ACCESS_TOKEN_CURL_CONFIG}@raw.githubusercontent.com/logpost/logpost-environment/master/environment/carrier-management-service/production.yml
RUN curl -o development.yml https://${GIT_ACCESS_TOKEN_CURL_CONFIG}@raw.githubusercontent.com/logpost/logpost-environment/master/environment/carrier-management-service/development.yml
RUN curl -o staging.yml https://${GIT_ACCESS_TOKEN_CURL_CONFIG}@raw.githubusercontent.com/logpost/logpost-environment/master/environment/carrier-management-service/staging.yml
RUN mv -f production.yml staging.yml development.yml config

RUN npm ci
RUN npm run build

# Starting stage
FROM node:14.2-slim
WORKDIR /usr/src/app
COPY --from=builder /usr/src/app/node_modules node_modules/
COPY --from=builder /usr/src/app/dist dist/
COPY --from=builder /usr/src/app/config config/
COPY --from=builder /usr/src/app/package.json .
EXPOSE 8081 8081
CMD [ "npm", "run", "start:prod"]

0 comments on commit 7d650e2

Please sign in to comment.