Skip to content

Commit

Permalink
chore - GitHub actions init
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaga committed Sep 25, 2023
1 parent 14963d7 commit 08107c6
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 1 deletion.
40 changes: 40 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Stay Young UI Build Pipeline

on:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
environment: Development
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: 16

- name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build Docker image
run: |
docker build \
--build-arg NEXT_PUBLIC_STAY_YOUNG_API=${{ vars.NEXT_PUBLIC_STAY_YOUNG_API }} \
--build-arg NEXT_PUBLIC_RECIPIENT_PHONE_NUMBER=${{ vars.NEXT_PUBLIC_RECIPIENT_PHONE_NUMBER }} \
--build-arg NEXT_PUBLIC_DOMAIN_NAME=${{ vars.NEXT_PUBLIC_DOMAIN_NAME }} \
-t jagalive/stay-young-ui:${{ github.sha }} .
docker tag jagalive/stay-young-ui:${{ github.sha }} jagalive/stay-young-ui:latest
working-directory: ./

- name: Push Docker image
run: |
docker push jagalive/stay-young-ui:${{ github.sha }}
docker push jagalive/stay-young-ui:latest
12 changes: 11 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,17 @@ FROM node:16-alpine
WORKDIR /usr/src/stayyoung
COPY package.json ./
COPY package-lock.json ./
COPY . .
RUN npm install

ARG NEXT_PUBLIC_STAY_YOUNG_API
ENV NEXT_PUBLIC_STAY_YOUNG_API $NEXT_PUBLIC_STAY_YOUNG_API

ARG NEXT_PUBLIC_RECIPIENT_PHONE_NUMBER
ENV NEXT_PUBLIC_RECIPIENT_PHONE_NUMBER $NEXT_PUBLIC_RECIPIENT_PHONE_NUMBER

ARG NEXT_PUBLIC_DOMAIN_NAME
ENV NEXT_PUBLIC_DOMAIN_NAME $NEXT_PUBLIC_DOMAIN_NAME

COPY . .
RUN npm run build
CMD [ "npm", "start" ]

0 comments on commit 08107c6

Please sign in to comment.