Example: build an image

A static site, built from the project's Dockerfile on every push.


compose builds the image on your docker engine on every deploy, so the project's own code goes live with each push.

Files #

Dockerfile

1FROM busybox:1.37
2COPY site/ /www/
3EXPOSE 8080
4CMD ["httpd", "-f", "-p", "8080", "-h", "/www"]

site/index.html

1<h1>hello from picd</h1>

compose.yaml

 1services:
 2  web:
 3    build: .
 4    labels:
 5      - traefik.enable=true
 6      - traefik.http.routers.site.rule=Host(`site-alice.user.cd.pico.sh`)
 7      - traefik.http.services.site.loadbalancer.server.port=8080
 8    networks: [picd-ingress]
 9networks:
10  picd-ingress:
11    external: true

The port label tells Traefik which port the container serves.

Deploy #

1git init -b main && git add . && git commit -m init
2git push ssh://cd.pico.sh/site.git main
3curl https://site-alice.user.cd.pico.sh

Edit site/index.html, commit, and push again to rebuild and redeploy.

<< PREV
Public IPv6
NEXT >>
A database