Skip to content

Commit e6a7a84

Browse files
Add Docker support with Dockerfile and docker-compose.yml
Introduce a `Dockerfile` and `docker-compose.yml` for containerization, enabling easier deployment and setup of the application. Updated the `README.md` with detailed instructions for building and running the app using Docker and Docker Compose.
1 parent 7903653 commit e6a7a84

File tree

3 files changed

+76
-0
lines changed

3 files changed

+76
-0
lines changed

Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Use the official Python image as the base image
2+
FROM python:3.9-slim
3+
4+
# Set a working directory inside the container
5+
WORKDIR /app
6+
7+
# Copy project files into the container
8+
COPY . /app
9+
10+
# Ensure pip is updated
11+
RUN pip install --upgrade pip
12+
13+
# Install required Python packages
14+
COPY requirements.txt ./
15+
RUN pip install -r requirements.txt
16+
17+
# Command to run your application
18+
CMD ["python", "main.py"]

README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,56 @@ These can also be set via arguments in the CLI:
182182
python3 main.py --mode daily --log-level INFO --show-detailed-logs
183183
```
184184

185+
## 🐳 Docker
186+
187+
You can run Squidleet using Docker. Below are the steps to set up and run the application using Docker.
188+
189+
### Build Docker Image
190+
191+
Clone the repository and navigate to the project directory:
192+
```bash
193+
git clone https://github.com/daily-coding-problem/squidleet.git
194+
cd squidleet
195+
```
196+
197+
Build the Docker image:
198+
```bash
199+
docker build -t squidleet .
200+
```
201+
202+
### Run the Docker Container
203+
204+
Run the Docker container and mount the directory where your environment file (`.env`) is located:
205+
```bash
206+
docker run --rm -it --env-file .env squidleet
207+
```
208+
209+
To specify additional options (e.g., modes), append them to the run command:
210+
```bash
211+
docker run --rm -it --env-file .env squidleet --mode daily
212+
```
213+
214+
### Using Docker Compose
215+
216+
If you prefer using Docker Compose, you can create a `docker-compose.yml` file with the following content:
217+
218+
```yaml
219+
version: "3.8"
220+
services:
221+
squidleet:
222+
build: .
223+
environment:
224+
- LEETCODE_SESSION=<your_session_cookie>
225+
stdin_open: true
226+
tty: true
227+
command: ["--mode", "daily"]
228+
```
229+
230+
To run the container:
231+
```bash
232+
docker-compose up
233+
```
234+
185235
## License
186236

187237
Squidleet is open-sourced under the MIT License. See the `LICENSE` file for more details.

docker-compose.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
services:
2+
squidleet:
3+
build:
4+
context: .
5+
container_name: squidleet
6+
image: squidleet:latest
7+
env_file:
8+
- .env

0 commit comments

Comments
 (0)