This commit is contained in:
root 2024-02-02 18:41:06 +01:00
parent 02e61f8ec6
commit 629b3cee80
1 changed files with 28 additions and 0 deletions

28
cloud-init.yml Normal file
View File

@ -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/s487175/aws-public-cloud/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