abubasith86 commited on
Commit
1f24288
Β·
1 Parent(s): 2d5cd83

Working as expected

Browse files
Files changed (2) hide show
  1. Dockerfile +0 -17
  2. deploy.py +0 -47
Dockerfile CHANGED
@@ -1,20 +1,3 @@
1
- # FROM node:23.7.0
2
-
3
- # # Set working directory
4
- # WORKDIR /app
5
-
6
- # # Copy deployment script
7
- # COPY deploy.py /deploy.py
8
-
9
- # # Set non-root user
10
- # RUN useradd -m appuser && chown -R appuser /app
11
- # USER appuser
12
-
13
- # # Run deployment script
14
- # CMD ["python3", "/deploy.py"]
15
-
16
-
17
- # Use the official Node.js image as the base image
18
  FROM node:23.7.0 as builder
19
 
20
  # Install git
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  FROM node:23.7.0 as builder
2
 
3
  # Install git
deploy.py DELETED
@@ -1,47 +0,0 @@
1
- import os
2
- import shutil
3
- import subprocess
4
-
5
- APP_DIR = "/app"
6
- TMP_DIR = "/tmp/repo_clone"
7
- REPO_URL = "https://github.com/abubasith456/Node-WLA.git"
8
-
9
-
10
- def remove_app_directory():
11
- if os.path.exists(APP_DIR):
12
- print("⚠️ Removing existing app directory...")
13
- shutil.rmtree(APP_DIR, ignore_errors=True)
14
-
15
-
16
- def clone_repository():
17
- print("πŸ”„ Cloning repository...")
18
- if os.path.exists(TMP_DIR):
19
- shutil.rmtree(TMP_DIR, ignore_errors=True)
20
-
21
- subprocess.run(["git", "clone", REPO_URL, TMP_DIR], check=True)
22
-
23
- print("πŸ“‚ Moving repository files to app directory...")
24
- shutil.move(TMP_DIR, APP_DIR)
25
-
26
-
27
- def install_dependencies():
28
- print("πŸ“¦ Installing dependencies...")
29
- subprocess.run(["npm", "install"], cwd=APP_DIR, check=True)
30
-
31
-
32
- def start_application():
33
- print("πŸš€ Starting application...")
34
- subprocess.Popen(["npm", "start"], cwd=APP_DIR)
35
-
36
-
37
- def main():
38
- print("πŸš€ Deployment started...")
39
- remove_app_directory()
40
- clone_repository()
41
- install_dependencies()
42
- start_application()
43
- print("βœ… Deployment complete.")
44
-
45
-
46
- if __name__ == "__main__":
47
- main()