From 1f64086d51ca83b0d813afeb20ffc485f0a0b171 Mon Sep 17 00:00:00 2001 From: Anibal Velarde Date: Mon, 14 Oct 2024 17:31:56 -0500 Subject: [PATCH 1/3] Updating the dockerfile to allow image-building on a Windows machine --- Dockerfile4WindowsBuild | 54 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 Dockerfile4WindowsBuild diff --git a/Dockerfile4WindowsBuild b/Dockerfile4WindowsBuild new file mode 100644 index 0000000..2e1d896 --- /dev/null +++ b/Dockerfile4WindowsBuild @@ -0,0 +1,54 @@ +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: MIT-0 +# Update: This version of the Dockerfile allows the user to build the Docker Image on a Windows 10 (or later) + +FROM amazonlinux:2023 +# Use dos2unix to convert line-endings +RUN yum install -y dos2unix + +# Replace the args to lock to a specific version +ARG GREENGRASS_RELEASE_VERSION=latest +ARG GREENGRASS_ZIP_FILE=greengrass-${GREENGRASS_RELEASE_VERSION}.zip +ARG GREENGRASS_RELEASE_URI=https://d2s8p88vqu9w66.cloudfront.net/releases/${GREENGRASS_ZIP_FILE} + +# Author +LABEL maintainer="AWS IoT Greengrass" +# Greengrass Version +LABEL greengrass-version=${GREENGRASS_RELEASE_VERSION} + +# Set up Greengrass v2 execution parameters +# TINI_KILL_PROCESS_GROUP allows forwarding SIGTERM to all PIDs in the PID group so Greengrass can exit gracefully +ENV TINI_KILL_PROCESS_GROUP=1 \ + GGC_ROOT_PATH=/greengrass/v2 \ + PROVISION=false \ + AWS_REGION=us-east-1 \ + THING_NAME=default_thing_name \ + THING_GROUP_NAME=default_thing_group_name \ + TES_ROLE_NAME=default_tes_role_name \ + TES_ROLE_ALIAS_NAME=default_tes_role_alias_name \ + COMPONENT_DEFAULT_USER=default_component_user \ + DEPLOY_DEV_TOOLS=false \ + INIT_CONFIG=default_init_config \ + TRUSTED_PLUGIN=default_trusted_plugin_path \ + THING_POLICY_NAME=default_thing_policy_name +RUN env + +# Entrypoint script to install and run Greengrass +COPY "greengrass-entrypoint.sh" / + +# Install Greengrass v2 dependencies +RUN yum update -y && \ + yum install -y tar unzip wget sudo procps which shadow-utils python3 java-11-amazon-corretto-headless && \ + wget $GREENGRASS_RELEASE_URI && \ + rm -rf /var/cache/yum && \ + chmod +x /greengrass-entrypoint.sh && \ + mkdir -p /opt/greengrassv2 $GGC_ROOT_PATH && unzip $GREENGRASS_ZIP_FILE -d /opt/greengrassv2 && rm $GREENGRASS_ZIP_FILE +RUN dos2unix /greengrass-entrypoint.sh + +# modify /etc/sudoers +COPY "modify-sudoers.sh" / +RUN chmod +x /modify-sudoers.sh +RUN dos2unix /modify-sudoers.sh +RUN ./modify-sudoers.sh + +ENTRYPOINT ["/greengrass-entrypoint.sh"] From 4fcd0c1fb6d1ad0a026066b4fdae593fb26a1093 Mon Sep 17 00:00:00 2001 From: Anibal Velarde Date: Mon, 14 Oct 2024 17:38:07 -0500 Subject: [PATCH 2/3] Updated README to guide Windows-based image building. --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b62782c..63e4c82 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,9 @@ This guide will show you how to: * Mac OSX or Linux host computer running Docker and Docker Compose (optional). * The Docker installation (version 18.09 or later) can be found [here](https://docs.docker.com/install/ ). * The Docker Compose installation (version 1.22 or later) can be found [here]( https://docs.docker.com/compose/install/). - Docker for Mac OS and Docker Toolbox include Compose, so those platforms don't need a separate Compose installation. Note: You must have version 1.22 or later because `init` support is required. + Docker for Mac OS and Docker Toolbox include Compose, so those platforms don't need a separate Compose installation. Note: You must have version 1.22 or later because `init` support is required. +* Windows OS + * Use the `Dockerfile4WindowsBuild` as your build image `-f` parameter ## Running AWS IoT Greengrass in a Docker Container The following steps show how to build the Docker image from the Dockerfile and configure AWS IoT Greengrass to run in a Docker container. From 167e641fdc116bc705781b757cdbc8acc10f2672 Mon Sep 17 00:00:00 2001 From: Anibal Velarde Date: Mon, 14 Oct 2024 17:42:00 -0500 Subject: [PATCH 3/3] Corrected the bullet point indents --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 63e4c82..b499442 100644 --- a/README.md +++ b/README.md @@ -11,11 +11,11 @@ This guide will show you how to: ## Prerequisites * Mac OSX or Linux host computer running Docker and Docker Compose (optional). - * The Docker installation (version 18.09 or later) can be found [here](https://docs.docker.com/install/ ). - * The Docker Compose installation (version 1.22 or later) can be found [here]( https://docs.docker.com/compose/install/). - Docker for Mac OS and Docker Toolbox include Compose, so those platforms don't need a separate Compose installation. Note: You must have version 1.22 or later because `init` support is required. + * The Docker installation (version 18.09 or later) can be found [here](https://docs.docker.com/install/ ). + * The Docker Compose installation (version 1.22 or later) can be found [here]( https://docs.docker.com/compose/install/). + * Docker for Mac OS and Docker Toolbox include Compose, so those platforms don't need a separate Compose installation. Note: You must have version 1.22 or later because `init` support is required. * Windows OS - * Use the `Dockerfile4WindowsBuild` as your build image `-f` parameter + * Use the `Dockerfile4WindowsBuild` as your build image `-f` parameter ## Running AWS IoT Greengrass in a Docker Container The following steps show how to build the Docker image from the Dockerfile and configure AWS IoT Greengrass to run in a Docker container.