diff --git a/Dockerfile b/Dockerfile index 98627a5..0360097 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,9 +2,10 @@ FROM ubuntu:20.04 ARG AWS_ACCESS_KEY_ID ARG AWS_SECRET_ACCESS_KEY +ARG AWS_SESSION_TOKEN ARG DEBIAN_FRONTEND=noninteractive -LABEL org.opencontainers.image.authors="Sebastian Sasu , Cristian Magherusan-Stanciu , Brooke McKim " +LABEL org.opencontainers.image.authors="Sebastian Sasu , Cristian Magherusan-Stanciu , Brooke McKim " RUN apt-get update > /dev/null RUN apt-get install -y python3 pip locales libxml2-dev libxslt-dev nodejs npm > /dev/null @@ -14,11 +15,16 @@ RUN locale-gen "en_US.UTF-8" WORKDIR /opt/app +# install dependencies into a dedicated Docker layer, to speed up subsequent builds a bit +COPY requirements.txt . +RUN pip3 install -r requirements.txt + COPY . . -RUN pip3 install -r requirements.txt RUN invoke build EXPOSE 8080 +ENV HTTP_HOST=0.0.0.0 + CMD ["invoke", "serve"] diff --git a/README.md b/README.md index 16f7ac7..b4392e1 100644 --- a/README.md +++ b/README.md @@ -63,9 +63,18 @@ docker build -t ec2instances.info . 3. Run a container from the built `docker` image: -```bash +````bash docker run -d --name some-container -p 8080:8080 ec2instances.info -``` + +4. Open [localhost:8080](http://localhost:8080) in your browser to see it in action. + +## Docker Compose + +Here's how you can build and run docker image using Docker Compose (tested with Docker Compose v2): + +```bash +docker-compose up +```` 4. Open [localhost:8080](http://localhost:8080) in your browser to see it in action. diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..bcb6965 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,11 @@ +version: '3' +services: + ec2instances.info: + build: + context: . + args: + - AWS_ACCESS_KEY_ID + - AWS_SECRET_ACCESS_KEY + - AWS_SESSION_TOKEN + ports: + - '8080:8080' diff --git a/in/rds.html.mako b/in/rds.html.mako index 08f5503..48a5e62 100644 --- a/in/rds.html.mako +++ b/in/rds.html.mako @@ -174,7 +174,7 @@ % endfor - % for platform, code in {'MySQL': '2', 'SQL Server Standard': '12', 'Aurora Postgres & MySQL': '21', 'Aurora I/O Optimized': '211', 'MariaDB': '18', 'Oracle Enterprise': '5'}.items(): + % for platform, code in {'MySQL': '2', 'SQL Server Express': '10','SQL Server Web': '11','SQL Server Standard': '12','SQL Server Enterprise': '15', 'Aurora Postgres & MySQL': '21', 'Aurora I/O Optimized': '211', 'MariaDB': '18', 'Oracle Enterprise': '5'}.items(): ${platform} On Demand Cost % if code != '211': @@ -257,7 +257,7 @@ % endfor - % for platform, code in {'MySQL': '2', 'SQL Server Standard': '12', 'Aurora Postgres & MySQL': '21', 'Aurora I/O Optimized': '211', 'MariaDB': '18', 'Oracle Enterprise': '5'}.items(): + % for platform, code in {'MySQL': '2', 'SQL Server Express': '10', 'SQL Server Web': '11', 'SQL Server Standard': '12','SQL Server Enterprise': '15', 'Aurora Postgres & MySQL': '21', 'Aurora I/O Optimized': '211', 'MariaDB': '18', 'Oracle Enterprise': '5'}.items(): % if inst['pricing'].get('us-east-1', {}).get(code, {}).get('ondemand', 'N/A') != "N/A": diff --git a/scrape.py b/scrape.py index 04af80b..b5c15b8 100755 --- a/scrape.py +++ b/scrape.py @@ -1058,9 +1058,9 @@ def add_availability_zone_info(instances): availability_zones.append(availability_zone_id) availability_zones.sort() region_availability_zones[region_name] = availability_zones - instance_type_region_availability_zones[ - instance_type - ] = region_availability_zones + instance_type_region_availability_zones[instance_type] = ( + region_availability_zones + ) for inst in instances: inst.availability_zones = instance_type_region_availability_zones.get( inst.instance_type, {} @@ -1186,9 +1186,9 @@ def fetch_dedicated_prices(): if inst_type not in all_pricing[region]: all_pricing[region][inst_type] = {"reserved": {}} - all_pricing[region][inst_type]["reserved"][ - translate_ri - ] = format_price(price) + all_pricing[region][inst_type]["reserved"][translate_ri] = ( + format_price(price) + ) return all_pricing