diff --git a/cloud-init.yml b/cloud-init.yml new file mode 100644 index 0000000..dc1893e --- /dev/null +++ b/cloud-init.yml @@ -0,0 +1,28 @@ +#cloud-config +packages: + - apt-transport-https + - ca-certificates + - curl + - gnupg-agent + - software-properties-common +write_files: + - path: /root/Dockerfile + content: | + FROM ubuntu + COPY ./webservice / + RUN chmod +x ./webservice + EXPOSE 80:8080/tcp + CMD ./webservice +runcmd: + - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - + - add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" + - apt-get update -y + - apt-get install -y docker-ce docker-ce-cli containerd.io + - curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose + - chmod +x /usr/local/bin/docker-compose + - curl -fsSL https://git.wmi.amu.edu.pl/s487186/aws/raw/branch/master/webservice > /root/webservice + - systemctl start docker + - systemctl enable docker + - cd /root/ + - docker build -t webservice . + - docker run -d -p 80:8080 -t webservice \ No newline at end of file