Request access

Kubernetes Example for webapp.io

FROM vm/ubuntu:18.04

# install docker-ce (from tutorial for ubuntu)
RUN apt-get update && \
    apt-get install apt-transport-https ca-certificates curl software-properties-common && \
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - && \
    add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable" && \
    apt-get update && \
    apt install docker-ce

# install & start k3s
RUN curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.21.2+k3s1 sh -s - --docker

# copy the root (i.e., repository root) to /root in the runner
COPY / /root

# TODO: log in to docker hub to avoid rate limits
# See https://webapp.io/docs/advanced-workflows#logging-in-to-docker to learn how to log in to docker

RUN REPEATABLE echo "replace this line with your image build command" && docker build -t image build-dir

# systemctl restart k3s is required here because tokens expire when things are hibernated
RUN systemctl restart k3s && echo "replace this line with your kubectl deploy command" && k3s kubectl apply -f deploy.yaml

# k3s comes with an ingress controller listening on port 443 already
# you could disable it and use "kubectl port-forward --address 0.0.0.0 svc/my-service 443:443" otherwise
# (change options of k3s install to  --docker --disable traefik to disable the default ingress controller)
EXPOSE WEBSITE https://localhost:443
Try this example live