derricka59 commited on
Commit
6c6d5da
·
verified ·
1 Parent(s): 1e2cce7

Create dockerfile

Browse files

from huggingface_hub import HfApi
from pathlib import Path

# --- Configuration ---
# Your Hugging Face username
hf_username = "your-hf-username"
# The name of the repository
repo_name = "deepseek-chatbot"
# The local path to your Dockerfile
local_dockerfile_path = "Dockerfile"
# The path where the file should be in the repository
repo_dockerfile_path = "Dockerfile"
# Your Hugging Face API token (replace with your actual token)
hf_token = "your-hf-token"

# --- Script ---
api = HfApi()
repo_id = f"{hf_username}/{repo_name}"

# Read the content of the Dockerfile
dockerfile_content = Path(local_dockerfile_path).read_text()

# Commit the Dockerfile to the repository
try:
api.upload_file(
path_or_fileobj=dockerfile_content.encode("utf-8"),
path_in_repo=repo_dockerfile_path,
repo_id=repo_id,
token=hf_token,
commit_message="Add Dockerfile for GPU support",
)
print(f"File '{repo_dockerfile_path}' committed to repository '{repo_id}'.")
except Exception as e:
print(f"Error committing file: {e}")

Files changed (1) hide show
  1. dockerfile +24 -0
dockerfile ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use an official NVIDIA CUDA runtime as a parent image
2
+ FROM nvidia/cuda:11.8.0-base-ubuntu20.04
3
+
4
+ # Set the working directory to /app
5
+ WORKDIR /app
6
+
7
+ # Install Python and pip
8
+ RUN apt-get update && \
9
+ apt-get install -y python3-pip
10
+
11
+ # Copy the current directory contents into the container at /app
12
+ COPY . /app
13
+
14
+ # Install any needed packages specified in requirements.txt
15
+ RUN pip install --no-cache-dir transformers torch sentencepiece accelerate huggingface_hub
16
+
17
+ # Make port 8888 available to the world outside this container
18
+ EXPOSE 8888
19
+
20
+ # Define environment variable
21
+ ENV NAME World
22
+
23
+ # Run app.py when the container launches
24
+ CMD ["python3", "app.py"]