{"id":18064524,"url":"https://github.com/no9/eleventy-serverless-docker","last_synced_at":"2026-04-18T04:33:35.365Z","repository":{"id":142837532,"uuid":"431108877","full_name":"No9/eleventy-serverless-docker","owner":"No9","description":"A project to demonstrate using 11ty serverless release In an aws lambda container backed off to s3 so you can create on-demand 11ty builds in any environment that supports containers. ","archived":false,"fork":false,"pushed_at":"2021-11-27T10:42:46.000Z","size":92,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-29T16:08:13.933Z","etag":null,"topics":["11ty","docker","jamstack"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/No9.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-23T13:21:10.000Z","updated_at":"2021-11-27T10:42:48.000Z","dependencies_parsed_at":"2023-08-25T02:34:51.808Z","dependency_job_id":null,"html_url":"https://github.com/No9/eleventy-serverless-docker","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/No9/eleventy-serverless-docker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/No9%2Feleventy-serverless-docker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/No9%2Feleventy-serverless-docker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/No9%2Feleventy-serverless-docker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/No9%2Feleventy-serverless-docker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/No9","download_url":"https://codeload.github.com/No9/eleventy-serverless-docker/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/No9%2Feleventy-serverless-docker/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31957013,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T00:39:45.007Z","status":"online","status_checked_at":"2026-04-18T02:00:07.018Z","response_time":103,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["11ty","docker","jamstack"],"created_at":"2024-10-31T06:06:41.461Z","updated_at":"2026-04-18T04:33:35.347Z","avatar_url":"https://github.com/No9.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# eleventy-serverless-docker\n\nA project to demonstrate using 11ty serverless in docker to generate on demand content where the data is stored in s3.\n\nThis is intended to be used in scenarios where a container environment is available to the developer but not public cloud access. \n\nThis project also aims to show how this approach can maintain the inner dev loop as well as a deployment folow.\n\nBased on this project https://github.com/SomeAnticsDev/eleventy-serverless-color-contrast\n\n## Step 1. General Setup\n\n1. Clone this repository\n    ```\n    git clone https://github.com/No9/eleventy-serverless-docker\n    ```\n1. Create an s3 bucket on your favourite cloud provider.\n\n1. Copy the contents of the folder `sampledata` to the s3 bucket\n\n1. Create some credentials for the bucket.\n\n1. Then and create a `.env` file in the base folder of this project with the following entries.\n\n    Replacing the XXXX with the vaules from the credentials you created.\n\n    ```\n    S3ACCESSKEY=XXXX\n    S3SECRET=XXXX\n    S3BUCKETNAME=XXXX\n    S3ENDPOINT=XXXX\n    ```\n\n\n## Step 2. local dev loop setup \n\n\n1. Install dependencies\n    ```\n    npm install\n    ```\n\n1. Run the local dev service\n\n    ```\n    npm run dev\n    ```\n1. Open a browser to see the output\n\n    http://localhost:8080/1/\n\n    http://localhost:8080/2/\n\n## Step 3. Create container\n\n1. Build the container\n\n    ```\n    docker build -t eleventy-serverless-docker .\n    ```\n\n1. Run the container\n    ```\n    docker run -p 8080:8080 --env-file .env eleventy-serverless-docker\n    ```\n\n1. Test the endpoint\n\n    ```\n    curl -s -d '{ \"path\" : \"/1/\" }' http://localhost:8080/2015-03-31/functions/function/invocations\n\n    {\"statusCode\":200,\n    \"headers\":{\"Content-Type\":\"text/html; charset=UTF-8\"},\n    \"body\":\"\\n\\n\u003c!DOCTYPE html\u003e\\n\u003chtml lang=\\\"en\\\"\u003e\\n\u003chead\u003e\\n\\t\u003cmeta charset=\\\"UTF-8\\\"\u003e\\n\\t\n    \u003cmeta http-equiv=\\\"X-UA-Compatible\\\" content=\\\"IE=edge\\\"\u003e\\n\\t\n    \u003cmeta name=\\\"viewport\\\" content=\\\"width=device-width, initial-scale=1.0\\\"\u003e\\n\\t\n    \u003ctitle\u003eDocument\u003c/title\u003e\\n\u003c/head\u003e\\n\u003cbody\u003e\\n\\t\\t\n    \u003ch1\u003e1 - Luke Skywalker\u003c/h1\u003e\\n\\t\\tbirth_year : 19BBY \u003cbr /\u003e\\n\\t\\t\n    gender : male \u003cbr/\u003e\\n\\t\\t\n    hair_color : blond\\n\\t\u003cbr/\u003e\\n\\t\n    \u003ch3\u003eBase Data :\u003c/h3\u003e\\n\\t\n    {\\\"birth_year\\\":\\\"19BBY\\\",\\\"created\\\":\\\"2014-12-09T13:50:51.644000Z\\\",\n    \\\"edited\\\":\\\"2014-12-20T21:17:56.891000Z\\\",\\\"eye_color\\\":\\\"blue\\\",\n    \\\"films\\\":[\\\"http://swapi.co/api/films/6/\\\",\\\"http://swapi.co/api/films/3/\\\",\n    \\\"http://swapi.co/api/films/2/\\\",\\\"http://swapi.co/api/films/1/\\\",\n    \\\"http://swapi.co/api/films/7/\\\"],\n    \\\"gender\\\":\\\"male\\\",\\\"hair_color\\\":\\\"blond\\\",\\\"height\\\":\\\"172\\\",\n    \\\"homeworld\\\":\\\"http://swapi.co/api/planets/1/\\\",\\\"id\\\":1,\\\"mass\\\":\\\"77\\\",\n    \\\"name\\\":\\\"Luke Skywalker\\\",\\\"skin_color\\\":\\\"fair\\\"}\\n\\t\n    \u003cmain\u003e\\n\\t\\t\u003cp\u003eeleventy.serverless : {\\\"path\\\":{\\\"coreid\\\":\\\"1\\\"}}\u003c/p\u003e\\n\\t\n    \u003c/main\u003e\\n\u003c/body\u003e\\n\u003c/html\u003e\\n\"}\n    ```\n\n## notes\n\n1. The docker file performs a double copy of the code to the root - `/var/task` and to `/var/task/knative/functions/ondemand`.\n    This is to factilitate the default aws lambda container and the 11ty default config.\n\n    There is probably an opportunity to streamline this in someway.\n\n1. When ran in lambda container the response is a JSON object.\n    The body in the return value needs to be transformed into a HTML response by a downstream system.\n    When hosted on netlify the CDN performs this function probably through the API gateway so we need to find an equivalent approach using either nginx or cloudflare.\n    In lambda this is usually done but using the `context.succeed(html);` but the `context` object is not available in the local 11ty serverless environment and so the inner dev loop would break with that approach.\n    Update - I've built https://github.com/No9/faas-content-proxy to mitigate this by providing a type of shim for the API Gateway.\n\n## credits\nSample data from Nolan Lawson\n\nhttps://github.com/nolanlawson/starwars-data/blob/master/people.json\n\nSample project from Ben Myers\n\nhttps://github.com/SomeAnticsDev/eleventy-serverless-color-contrast\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fno9%2Feleventy-serverless-docker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fno9%2Feleventy-serverless-docker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fno9%2Feleventy-serverless-docker/lists"}