Skip to content

Commit 2eae248

Browse files
Fix #2129: Fix missing clone step and path to correct Dockerfile
1 parent e144e0a commit 2eae248

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

docker_builder.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import subprocess
2+
3+
class DockerBuilder:
4+
def __init__(self, dockerfile_path):
5+
self.dockerfile_path = dockerfile_path
6+
7+
def clone_repo(self, repo_url):
8+
# Clone the repository using git
9+
subprocess.run(['git', 'clone', repo_url])
10+
11+
def build_docker_image(self):
12+
# Build the Docker image using the Dockerfile
13+
subprocess.run(['docker', 'build', '-t', 'my-image', self.dockerfile_path])
14+
15+
# Usage
16+
builder = DockerBuilder('./Dockerfile')
17+
builder.clone_repo('https://github.com/user/repo.git')
18+
builder.build_docker_image()

0 commit comments

Comments
 (0)