diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 000000000..f3aa0e0dc --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,27 @@ +name: Docker Image CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build_and_push: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: highkay/chatbox-web:latest \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..1a526a6cf --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +# ---- Base ---- +FROM node:22-alpine AS base +WORKDIR /app +COPY package.json package-lock.json* ./ + +# ---- Dependencies ---- +FROM base AS dependencies +RUN npm config set registry https://registry.npmmirror.com/ && \ + npm install --ignore-scripts && \ + npm cache clean --force + +# ---- Build ---- +FROM dependencies AS build +COPY . . +RUN npm run build:web + +# ---- Production ---- +FROM nginx:alpine AS production +COPY --from=build /app/release/app/dist/renderer /usr/share/nginx/html +EXPOSE 80 +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..faee9c811 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,9 @@ +version: '3.8' + +services: + chatbox: + build: . + ports: + - "3000:3000" + volumes: + - ./data:/root/.config/xyz.chatboxapp.ce