Skip to content

Commit

Permalink
Added deploy step
Browse files Browse the repository at this point in the history
  • Loading branch information
hkirat committed Mar 31, 2024
1 parent 1873a36 commit 9793206
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 1 deletion.
33 changes: 33 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Build and Deploy to Docker Hub

on:
push:
branches:
- master # Adjusted to trigger on pushes to master

jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Check Out Repo
uses: actions/checkout@v2

- name: Prepare Dockerfile
run: cp ./docker/Dockerfile.user ./Dockerfile

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

- name: Build and Push Docker image
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: 100xdevs/web-app:latest

- name: Verify Pushed Image
run: docker pull 100xdevs/web-app:latest
18 changes: 18 additions & 0 deletions docker/Dockerfile.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM node:20.12.0-alpine3.19

WORKDIR /usr/src/app

COPY package.json package-lock.json turbo.json tsconfig.json ./

COPY apps ./apps
COPY packages ./packages

# Install dependencies
RUN npm install
# Can you add a script to the global package.json that does this?
RUN cd packages/db && npx prisma generate && cd ../..

# Can you filter the build down to just one app?
RUN npm run build

CMD ["npm", "run", "start-user-app"]
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"build": "turbo build",
"dev": "turbo dev",
"lint": "turbo lint",
"format": "prettier --write \"**/*.{ts,tsx,md}\""
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
"start-user-app": "cd ./apps/user-app && npm run start"
},
"devDependencies": {
"@repo/eslint-config": "*",
Expand Down

0 comments on commit 9793206

Please sign in to comment.