diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..9b6ba83 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,39 @@ +# Node modules should not be copied to the Docker image as they are re-installed during the build process. +node_modules +npm-debug.log +yarn-debug.log +yarn-error.log + +# Exclude the local environment variables +.env +.env.local +.env.*.local + +# Output directories +dist +build + +# Exclude Dockerfile and Docker ignore file itself +Dockerfile +.dockerignore + +# Ignore any git-related files +.git +.gitignore + +# Exclude local development files and tools +.vscode +.idea +*.swp + +# OS generated files +.DS_Store +Thumbs.db + +# Logs and temporary files +*.log +*.tmp + +# netlfiy configs +netlfiy.toml + diff --git a/.github/workflows/docker_deploy.yaml b/.github/workflows/docker_deploy.yaml new file mode 100644 index 0000000..87e0e5e --- /dev/null +++ b/.github/workflows/docker_deploy.yaml @@ -0,0 +1,44 @@ +name: Seller App Docker Build and Push + +on: + push: + branches: + - master + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v4 + - + name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - + name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - + name: Build and push + uses: docker/build-push-action@v6 + with: + context: . + push: true + tags: ${{ secrets.DOCKERHUB_USERNAME }}/apekade_seller:latest + - + name: Add build summary + run: | + echo '### 🚀 Docker Build and Push Summary' > $GITHUB_STEP_SUMMARY + echo '' >> $GITHUB_STEP_SUMMARY + echo '🔧 **Build Status**: The Docker image has been successfully built and pushed.' >> $GITHUB_STEP_SUMMARY + echo '' >> $GITHUB_STEP_SUMMARY + echo '🛠️ **Build Context**: .' >> $GITHUB_STEP_SUMMARY + echo '📦 **Image Tag**: ${{ secrets.DOCKERHUB_USERNAME }}/apekade_seller:latest' >> $GITHUB_STEP_SUMMARY + echo '' >> $GITHUB_STEP_SUMMARY + echo '🎉 **Thanks for using GitHub Actions!**' >> $GITHUB_STEP_SUMMARY diff --git a/.github/workflows/post.yaml b/.github/workflows/post.yaml new file mode 100644 index 0000000..f4838d5 --- /dev/null +++ b/.github/workflows/post.yaml @@ -0,0 +1,41 @@ +name: Review + +on: + issues: + types: [opened] + pull_request_target: + types: [opened] + +jobs: + review: + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Add Summary for reviews + run: echo '### reviews Workflow Summary 🚀' > $GITHUB_STEP_SUMMARY + + - name: Post review message for issues + if: github.event_name == 'issues' + run: | + curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + -H "Accept: application/vnd.github.v3+json" \ + --request POST \ + --data '{"body":"👋 Thank you for opening this issue! We will get back to you shortly."}' \ + https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/comments + echo 'Issue review message posted.' >> $GITHUB_STEP_SUMMARY + + - name: Post review message for pull requests + if: github.event_name == 'pull_request_target' + run: | + curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + -H "Accept: application/vnd.github.v3+json" \ + --request POST \ + --data '{"body":"🎉 Thank you for this pull request! We will review it as soon as possible."}' \ + https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments + echo 'Pull request review message posted.' >> $GITHUB_STEP_SUMMARY diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4618ad1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +# Use an official Node.js runtime as a parent image +FROM node:20-alpine + +# Set the working directory in the container +WORKDIR /app + +# Copy package.json and package-lock.json +COPY package.json package-lock.json ./ + +# Install dependencies +RUN npm install + +# Copy the rest of the application files +COPY . . + +# Build the app +RUN npm run build + +# Expose port 4757 +EXPOSE 4757 + +# Start nginx +CMD ["npm","run","preview"] diff --git a/vite.config.js b/vite.config.js index 5a33944..afa12bc 100644 --- a/vite.config.js +++ b/vite.config.js @@ -4,4 +4,8 @@ import react from '@vitejs/plugin-react' // https://vitejs.dev/config/ export default defineConfig({ plugins: [react()], + preview: { + host: true, + port: 4757 + } })