From cfb7881a5b739fcb4ab4f0b84e92a62a4f00da62 Mon Sep 17 00:00:00 2001 From: Arthur Khachaturov Date: Fri, 26 Jul 2024 14:16:49 +0300 Subject: [PATCH] chore: update dockerfile and readme.md --- Dockerfile | 14 +++++--------- README.md | 42 +++++++++++++++++++++++++++++++++++++----- docker-compose.yml | 5 ----- 3 files changed, 42 insertions(+), 19 deletions(-) delete mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile index b8291d5..13e1aff 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,7 @@ FROM debian:stable-slim - RUN apt-get update && apt-get install socat file -y - -WORKDIR /opt/app - -COPY src/ /opt/app/ - -EXPOSE 80 - -CMD /opt/app/main.sh run +ENV HTTB_LIB_PATH="/usr/lib/httb" +WORKDIR ${HTTB_LIB_PATH} +COPY src/ . +WORKDIR / +CMD ["/bin/bash"] diff --git a/README.md b/README.md index 8696ca0..67f0a58 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ A simple HTTP framework written entirely in bash! HTTB allows you to create a basic HTTP server using only bash scripts and the `socat` utility. It's utterly slow and useless, but if you _really_ want to build a web server in bash, then you have a tool for it! # 🛠️ Setup -These instructions will help you get started with HTTB! +These instructions will help you get started with httb! ## 🐋 Docker I would heavily recommend **not** running this on bare metal, as safety was (and still is) my last concern at the moment. This repository contains an example `Dockerfile` and `docker-compose.yml` files that can get you started. @@ -17,13 +17,45 @@ To get started with Docker: cd httb ``` -2. **Build and run the Docker image**: +2. **Build the Docker image with a tag**: ```sh - docker compose up --build + docker build -t httb . ``` +3. **Edit your Dockerfile to include `FROM httb:latest`**: + Ensure your `Dockerfile` uses the `httb:latest` directive: + + ```Dockerfile + FROM httb:latest + + # Add your additional setup steps here, if needed + ``` + +4. **Run the Docker container using `docker-compose`**: + ```sh + docker-compose up --build + ``` + +### Example `docker-compose.yml` +Here is an example `docker-compose.yml` file to help you get started: + +```yaml +version: '3.8' + +services: + httb: + image: httb:latest + build: + context: . + dockerfile: Dockerfile + ports: + - "8080:8080" +``` + +With these steps and files, you should be able to set up and run your httb server in a Docker container. + ## 🖥️ Native -If you prefer to run HTTB natively on your system, ensure you have `bash socat file` installed. These tools are necessary for running this server. +If you prefer to run httb natively on your system, ensure you have `bash socat file` installed. These tools are necessary for running this server. ### Debian/Linux Mint To install dependencies on Debian-based systems: @@ -47,7 +79,7 @@ brew install socat On Windows, you can use WSL (Windows Subsystem for Linux) to run a Linux distribution and follow the instructions for your preferred distro. # 📋 Usage -Here is a sample script to get you started with HTTB: +Here is a sample script to get you started with httb: ```sh #!/bin/bash diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 2fbc5cf..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,5 +0,0 @@ -services: - httb: - build: . - ports: - - 8081:80