Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Docker

SWS has first-classDocker support.

It is provided in three Docker image variants such asScratch,Alpine andDebian images.

All images are available onDocker Hub andGitHub Container Registry.

OS/Arch

All Docker images areMulti-Arch and the following operating systems and architectures are supported.

  • linux/386
  • linux/amd64
  • linux/arm/v6
  • linux/arm/v7
  • linux/arm64
  • linux/ppc64le (Debian only)
  • linux/s390x (Debian only)

SWS statically-linked binary

All the Docker images use the SWS statically-linked binary, meaning that the binary is highly optimized, performant, and dependency-free thanks tomusl libc.

Run a container

To give the server a quick try just run the following commands.

Tips

  • The SWS CLI arguments can be provided directly to the container or omitted as shown below.
  • A Docker volume like-v $HOME/my-public-dir:/public can be specified to overwrite the default root directory.

To run SWS, there are several Docker image variants that you can use.

Scratch (just the binary)

dockerrun--rm-it-p8787:80joseluisq/static-web-server:2-ginfo# ordockerrun--rm-it-p8787:80ghcr.io/static-web-server/static-web-server:2-ginfo

Alpine

dockerrun--rm-it-p8787:80joseluisq/static-web-server:2-alpine-ginfo# ordockerrun--rm-it-p8787:80ghcr.io/static-web-server/static-web-server:2-alpine-ginfo

Debian

dockerrun--rm-it-p8787:80joseluisq/static-web-server:2-debian-ginfo# ordockerrun--rm-it-p8787:80ghcr.io/static-web-server/static-web-server:2-debian-ginfo

Development

Additionally, we publishdevelopment Docker images based onmaster branch changes.

# Scratch (just the binary)dockerrun--rm-it-p8787:80ghcr.io/static-web-server/static-web-server:devel-ginfo# Debiandockerrun--rm-it-p8787:80ghcr.io/static-web-server/static-web-server:devel-debian-ginfo

Dockerfile

SWS Docker images can be extended as needed.

Extending theScratch Docker image (just the binary)

FROMjoseluisq/static-web-server:2# orFROMghcr.io/static-web-server/static-web-server:2# do stuff...

Or theAlpine

FROMjoseluisq/static-web-server:2-alpine# orFROMghcr.io/static-web-server/static-web-server:2-alpine# do stuff...

Or theDebian

FROMjoseluisq/static-web-server:2-debian# orFROMghcr.io/static-web-server/static-web-server:2-debian# do stuff...

Docker Compose

Example usingDocker Compose.

version:"3.3"services:website:image:joseluisq/static-web-server:2-alpinecontainer_name:"website"ports:-80:80restart:unless-stoppedenvironment:# Note: those envs are customizable but also optional-SERVER_ROOT=/var/public-SERVER_CONFIG_FILE=/etc/sws.tomlvolumes:-./public:/var/public-./sws.toml:/etc/sws.toml

Traefik Proxy

Example usingDocker Swarm andTraefik Proxy.

  1. Create an externaltraefik_net Docker attachable network for Traefik:
    • docker network create --driver=overlay --attachable traefik_net
  2. Map a host directory like/var/www/website to the service container or create an externalwebsite_data Docker volume if you prefer:
    • docker volume create website_data
version:"3.3"services:traefik:image:"traefik:v2.11"command:#- "--log.level=DEBUG"-"--api.insecure=true"-"--providers.docker=true"-"--providers.docker.exposedbydefault=false"-"--entrypoints.web.address=:80"ports:-"80:80"-"8080:8080"volumes:-"/var/run/docker.sock:/var/run/docker.sock:ro"website:image:joseluisq/static-web-server:2environment:# Note: those envs are customizable but also optional-SERVER_ROOT=/publicvolumes:-/var/www/website:/public# Or use an existing Docker volume# - website_data:/publiclabels:-"traefik.enable=true"-"traefik.docker.network=traefik_net"-"traefik.http.routers.website.entrypoints=web"-"traefik.http.routers.website.rule=Host(`website.localhost`)"-"traefik.http.routers.website.priority=1"-"traefik.http.services.website.loadbalancer.server.port=80"networks:-traefik_net# volumes:#   website_data:#     external: truenetworks:traefik_net:external:true

Kubernetes

Example usingKubernetes pod with liveness probe.

apiVersion:v1kind:Podmetadata:name:websitespec:containers:-name:swsimage:ghcr.io/static-web-server/static-web-servercommand:-static-web-server---root=/public---healthports:-containerPort:80livenessProbe:httpGet:path:/healthport:http

TrueCharts

TheTrueCharts Community also provides a ready-to-useStatic Web Server Helm-Chart that you can easily deploy in your Kubernetes.

2025-07-02

[8]ページ先頭

©2009-2025 Movatter.jp