Skip to content

siamaknaghel/docker-socket-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

⚡️ Socket Server (Dockerized)

A simple Socket.IO + Express.js server containerized with Docker. This project enables real-time communication between clients via WebSockets.


📁 Project Structure

socket-app/
├── docker-compose.yml       # Docker Compose service definition
└── socket-server/
    ├── Dockerfile           # Node.js Docker image config
    ├── index.js             # Main server code
    ├── package.json         # Dependencies list
    └── package-lock.json    # NPM lock file

🚀 Getting Started

1. Clone the repository

git clone git@github.com:siamaknaghel/docker-socket-server.git
cd socket-app

2. Build & Run with Docker Compose

docker-compose up --build

Once running, the server will be available at:

http://localhost:3000

🧠 Tech Stack


🛠️ Scripts

Inside package.json:

"scripts": {
  "start": "node index.js"
}

⚙️ Docker Configuration

Dockerfile

FROM node:18

WORKDIR /app

COPY package*.json ./
RUN npm install

COPY . .

EXPOSE 3000
CMD ["npm", "start"]

docker-compose.yml

version: '3'
services:
  socket-server:
    build:
      context: ./socket-server
      dockerfile: Dockerfile
    ports:
      - "3000:3000"
    volumes:
      - ./socket-server:/app
    working_dir: /app
    command: npm start

💬 Quick Test

You can test it using Postman or a basic Socket.IO client to connect to localhost:3000.


📄 License

This project is licensed under the MIT License.


🙌 Contributing

Feel free to open issues or submit pull requests. Contributions are welcome!



⚡️ سرور Socket (داکرایز شده)

یک سرور ساده با استفاده از Socket.IO و Express.js که با Docker کانتینرایز شده. این پروژه امکان ارتباط لحظه‌ای (real-time) بین کلاینت‌ها را فراهم می‌کند.


📁 ساختار پروژه

socket-app/
├── docker-compose.yml       # تعریف سرویس‌ها با Docker Compose
└── socket-server/
    ├── Dockerfile           # پیکربندی image برای Node.js
    ├── index.js             # کد اصلی سرور
    ├── package.json         # لیست وابستگی‌ها
    └── package-lock.json    # لاک فایل npm

🚀 شروع سریع

۱. کلون کردن مخزن

git clone git@github.com:siamaknaghel/docker-socket-server.git
cd socket-app

۲. ساخت و اجرای پروژه با Docker Compose

docker-compose up --build

بعد از اجرا، سرور روی آدرس زیر در دسترس خواهد بود:

http://localhost:3000

🧠 تکنولوژی‌های استفاده‌شده


🛠️ اسکریپت‌ها

در فایل package.json:

"scripts": {
  "start": "node index.js"
}

⚙️ پیکربندی Docker

فایل Dockerfile

FROM node:18

WORKDIR /app

COPY package*.json ./
RUN npm install

COPY . .

EXPOSE 3000
CMD ["npm", "start"]

فایل docker-compose.yml

version: '3'
services:
  socket-server:
    build:
      context: ./socket-server
      dockerfile: Dockerfile
    ports:
      - "3000:3000"
    volumes:
      - ./socket-server:/app
    working_dir: /app
    command: npm start

💬 تست سریع

می‌تونی با Postman یا کلاینت ساده‌ی Socket.IO به localhost:3000 وصل بشی و تست کنی.


📄 مجوز

این پروژه تحت مجوز MIT ارائه شده است.


🙌 مشارکت

اگر مایل به همکاری هستی، خوشحال می‌شم Pull Request بزنی یا issue باز کنی.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published