diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..db2b3b9 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,19 @@ +# Ignore node_modules, git, logs, and other local/development artifacts +node_modules/ +.git/ +*.log +Dockerfiles/Dockerfile.devenv +.vscode/ +.env +__pycache__/ +*.pyc +*.swp +# macOS and OS-specific files +.DS_Store +.AppleDouble +.LSOverride +Icon? +._* +Thumbs.db +ehthumbs.db +Desktop.ini diff --git a/.github/workflows/github-actions-demo.yml b/.github/workflows/github-actions-demo.yml new file mode 100644 index 0000000..b00f8e9 --- /dev/null +++ b/.github/workflows/github-actions-demo.yml @@ -0,0 +1,18 @@ +name: GitHub Actions Demo +run-name: ${{ github.actor }} is testing out GitHub Actions 🚀 +on: [push] +jobs: + Explore-GitHub-Actions: + runs-on: ubuntu-latest + steps: + - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." + - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" + - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." + - name: Check out repository code + uses: actions/checkout@v5 + - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." + - run: echo "🖥️ The workflow is now ready to test your code on the runner." + - name: List files in the repository + run: | + ls ${{ github.workspace }} + - run: echo "🍏 This job's status is ${{ job.status }}." diff --git a/Dockerfiles/Dockerfile b/Dockerfiles/Dockerfile new file mode 100644 index 0000000..de92721 --- /dev/null +++ b/Dockerfiles/Dockerfile @@ -0,0 +1,30 @@ + +# ---------- Base Stage ---------- +FROM ubuntu:22.04-slim AS base +SHELL ["/bin/bash", "-o", "pipefail", "-c"] +RUN apt-get update -y && apt-get upgrade -y && \ + apt-get install -y curl sudo && \ + useradd -ms /bin/bash ubuntu && \ + usermod -aG sudo ubuntu && \ + chown -R ubuntu:ubuntu /home/ubuntu && \ + apt-get clean && rm -rf /var/lib/apt/lists/* + +ENV HOME=/home/ubuntu +WORKDIR $HOME + +# ---------- Standard Environment ---------- +FROM base AS standard +USER ubuntu +RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash && \ + . "$HOME/.nvm/nvm.sh" && nvm install --lts && npm install -g @haxtheweb/create +CMD ["/bin/bash"] + +# ---------- Dev Environment ---------- +FROM base AS dev +USER ubuntu +RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash && \ + . "$HOME/.nvm/nvm.sh" && nvm install --lts && npm install -g @haxtheweb/create yarn && \ + yarn global add symlink-dir @web/test-runner @web/test-runner-commands \ + @web/test-runner-puppeteer @web/test-runner-playwright lerna web-component-analyzer && \ + npm completion >> ~/.bashrc +CMD ["/bin/bash"] \ No newline at end of file diff --git a/README.md b/README.md index 5e75b15..cc00cb9 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,53 @@ # containers -containers in hax land + +Containerization of HAXTheWeb dev environments and deployments — containers in hax land + +## Project Overview + +This repository provides Docker Compose configurations for both a simple hosting environment and a full-featured development environment for HAXTheWeb. + +## Prerequisites + +- [Docker](https://docs.docker.com/get-docker/) +- [Docker Compose](https://docs.docker.com/compose/) + +## Usage + +### Simple Host + +To run a single, unmanaged site: + +```sh +docker compose up -d simplehost +``` + +- Access your site at [http://localhost:8000](http://localhost:8000) +- Data is persisted in the `simplehost_data` volume. + +### Developer Environment + +To start the full-featured dev environment: + +```sh +docker compose up -d devenv +``` + +- Access your dev environment at [http://localhost:8001](http://localhost:8001) +- Data is persisted in the `devenv_data` volume. + +### Stopping and Removing Containers + +```sh +docker compose down +``` + +## Services + +- **simplehost**: Minimal environment for hosting a single site. +- **devenv**: Full dev environment with extra tools and utilities. + +## Example Commands + +- Build images: `docker compose build` +- View running containers: `docker compose ps` +- View logs: `docker compose logs ` diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..1888785 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,30 @@ +services: + # Simple host: for running a single, unmanaged site + simplehost: + build: + context: . + dockerfile: ./Dockerfiles/Dockerfile + target: standard + ports: + - "8000:3000" + tty: true + container_name: simplehost + volumes: + - simplehost_data:/data + + # Dev environment: for full-featured development + devenv: + build: + context: . + dockerfile: ./Dockerfiles/Dockerfile + target: dev + ports: + - "8001:3000" + tty: true + container_name: devenv + volumes: + - devenv_data:/data +# Named volumes for persistent data +volumes: + simplehost_data: + devenv_data: \ No newline at end of file