Skip to content

Commit

Permalink
Add client dockerfile and cd workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
sahinakkaya committed Dec 6, 2024
1 parent a414833 commit 95e25ca
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/clients.cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Clients CD
on:
workflow_dispatch:
# schedule:
# - cron: '38 19 * * *' # run the cron job every day at 19.38
# push:
# branches:
# - "main"
# tags-ignore:
# - "**"
# paths:
# - "clients/**"
# - ".github/workflows/**"
# - ".github/actions/**"
env:
REGISTRY: ghcr.io
jobs:
build-and-push-blackjack-frontend:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/sahinakkaya/blackjack-frontend
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: client
file: client/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
23 changes: 23 additions & 0 deletions client/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Use the official Node.js image with Alpine Linux
FROM node:20-alpine

# Set the working directory in the container
WORKDIR /app

# Copy package.json and yarn.lock to the working directory
COPY package.json yarn.lock ./

# Install dependencies using Yarn
RUN yarn install --frozen-lockfile

# Copy the rest of the application code
COPY . .

# Build the application for production
RUN yarn build

# Expose the port the app runs on (optional)
EXPOSE 3000

# Define the command to run the app
CMD ["yarn", "start"]

0 comments on commit 95e25ca

Please sign in to comment.