diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..f766fcc --- /dev/null +++ b/.dockerignore @@ -0,0 +1,33 @@ +# Ignore node_modules since it will be installed inside the container +node_modules +build +dist + +# Ignore logs and temp files +*.log +*.tmp +*.cache + +# Ignore local environment configuration +.env +.env.local + +# Ignore yarn error log +yarn-error.log + +# Ignore git directory and related files +.git +.gitignore + +# Ignore IDE/editor specific files +.vscode +.idea +*.swp + +# Ignore Docker-specific files +Dockerfile +docker-compose.yml + +# Ignore any other unnecessary files or directories +README.md +LICENSE \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..4331af5 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,43 @@ +name: Build and publish + +on: + push: + branches: [ master ] + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build-and-publish: + runs-on: ocean + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + token: ${{ secrets.MY_PAT_TOKEN }} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.MY_PAT_TOKEN }} + + - name: Build and Push Docker image + uses: docker/build-push-action@v6 + with: + context: . + file: Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + no-cache: true + tags: ghcr.io/${{ github.repository }}:latest + provenance: false diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3f7b1b2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,29 @@ +# Use an official Node.js runtime as the base image +FROM node:16-alpine AS build + +# Set the working directory inside the container +WORKDIR /app + +# Copy the package.json and yarn.lock files to install dependencies +COPY package.json yarn.lock ./ + +# Install dependencies +RUN yarn install + +# Copy the rest of the application code to the container +COPY . . + +# Build the React application +RUN yarn build + +# Stage 2: Serve the built files using a lightweight server (nginx) +FROM nginx:alpine + +# Copy the build output from the previous stage to the nginx public directory +COPY --from=build /app/build /usr/share/nginx/html + +# Expose the default Nginx port +EXPOSE 80 + +# Start Nginx +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/public/index.html b/public/index.html index 6b4252c..fa4d15b 100755 --- a/public/index.html +++ b/public/index.html @@ -8,35 +8,13 @@ content="width=device-width, initial-scale=1, shrink-to-fit=no" /> - + - - -