aws-public-cloud/cloud-init.yml

28 lines
1.0 KiB
YAML
Raw Permalink Normal View History

2024-02-02 18:41:06 +01:00
#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