diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..fb3316c --- /dev/null +++ b/.dockerignore @@ -0,0 +1,14 @@ +node_modules +.git +*.log +dist +.vscode +.idea +*.swp +*.swo +*~ +.DS_Store +.env.local +.env.*.local +coverage +.cache \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..cf09d10 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM node:18-alpine AS builder +WORKDIR /app +COPY package*.json ./ +RUN npm ci +COPY . . +RUN npm run build + +FROM node:18-alpine AS runner +WORKDIR /app +RUN npm install -g serve +COPY --from=builder /app/dist ./dist +EXPOSE 3000 +CMD ["serve", "-s", "dist", "-l", "3000"] \ No newline at end of file diff --git a/README.md b/README.md index 40a34fd..7d29c45 100644 --- a/README.md +++ b/README.md @@ -64,4 +64,17 @@ The app is lightweight and run entirely on your client-side, ensures a seamless - JWT Decoder - SQL Formatter - Unix Timestamp Parser -- Cron Expression Parser \ No newline at end of file +- Cron Expression Parser + +### Deployment +#### Use docker +The app is built with [Vite](https://vitejs.dev/) and [React](https://reactjs.org/). To deploy it on your own server, follow these steps: +1. Clone the repository +2. Run `docker build -t truedevtools .` to build the Docker image +3. Run `docker run -d --restart always -p 3000:3000 --name truedevtools truedevtools` to start the container +4. Open `http://localhost:3000` in your browser + +#### Use docker-compose +1. Clone the repository +2. Run `docker compose up -d --build` to build and start the container +3. Open `http://localhost:3000` in your browser diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..e5e350f --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,25 @@ +version: '3.8' + +services: + truedevtools: + build: + context: . + dockerfile: Dockerfile + container_name: truedevtools + restart: always + ports: + - "3000:3000" + environment: + - NODE_ENV=production + healthcheck: + test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:3000"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 40s + logging: + driver: "json-file" + options: + max-size: "10m" + max-file: "3" +