Skip to content

Commit

Permalink
Adding dockerfile to build agent
Browse files Browse the repository at this point in the history
  • Loading branch information
Thor-Bjorgvinsson authored and VishnuKarthikRavindran committed Nov 17, 2020
1 parent db1eed5 commit d340af9
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 10 deletions.
6 changes: 6 additions & 0 deletions Dockerfile
@@ -0,0 +1,6 @@
FROM golang:1.13.14

RUN apt -y update && apt -y upgrade && apt -y install rpm tar gzip wget zip && apt clean all

RUN mkdir /amazon-ssm-agent
WORKDIR /amazon-ssm-agent
18 changes: 18 additions & 0 deletions NOTICE.md
Expand Up @@ -346,3 +346,21 @@ distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

=================

Docker
Copyright 2012-2015 Docker, Inc.

This product includes software developed at Docker, Inc. (https://www.docker.com).

The following is courtesy of our legal counsel:

```
Use and transfer of Docker may be subject to certain restrictions by the
United States and other governments.
It is your responsibility to ensure that your use and/or transfer does not
violate applicable laws.
For more information, please see https://www.bis.doc.gov
```
28 changes: 20 additions & 8 deletions README.md
Expand Up @@ -39,36 +39,47 @@ SSM Agent also enables the Session Manager capability that lets you manage your
## Feedback

Thank you for helping us to improve Systems Manager, Run Command and Session Manager. Please send your questions or comments to [Systems Manager Forums](https://forums.aws.amazon.com/forum.jspa?forumID=185&start=0)

## Building and Running from source

* Install go [Getting started](https://golang.org/doc/install)
### Building inside docker container (Recommended)
* Install docker: [Install CentOS](https://docs.docker.com/engine/install/centos/)

* Install rpm-build
* Build image
```
docker build -t ssm-agent-build-image .
```
sudo yum install -y rpmdevtools rpm-build
* Build the agent
```
docker run -it --rm --name ssm-agent-build-container -v `pwd`:/amazon-ssm-agent ssm-agent-build-image make build-release
```

### Building on Linux

* Install go [Getting started](https://golang.org/doc/install)

* Install rpm-build and rpmdevtools

* [Cross Compile SSM Agent](https://www.ardanlabs.com/blog/2013/10/cross-compile-your-go-programs.html)

* Run `make build` to build the SSM Agent for Linux, Debian, Windows environment.

* Run `make release` to build the agent and also packages it into a RPM, DEB and ZIP package.
* Run `make build-release` to build the agent and also packages it into a RPM, DEB and ZIP package.

The following folders are generated when the build completes:
```
bin/debian_386
bin/debian_amd64
bin/linux_386
bin/linux_amd64
bin/linux_arm
bin/linux_arm64
bin/windows_386
bin/windows_amd64
```
* To enable the Agent for Session Manager scenario on Windows instances
* Clone the repo from https://github.com/masatma/winpty.git
* Follow instructions on https://github.com/rprichard/winpty to build winpty 64-bit binaries
* Copy the winpty.dll and winpty-agent.exe to the bin/SessionManagerShell folder
For the Windows Operating System, Session Manager is only supported on Windows Server 2008 R2 through Windows Server 2016 64-bit versions.
For the Windows Operating System, Session Manager is only supported on Windows Server 2008 R2 through Windows Server 2019 64-bit versions.

Please follow the user guide to [copy and install the SSM Agent](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/install-ssm-agent.html)

Expand All @@ -93,7 +104,8 @@ The following targets are available. Each may be run with `make <target>`.
| Make Target | Description |
|:-------------------------|:------------|
| `build` | *(Default)* `build` builds the agent for Linux, Debian, Darwin and Windows amd64 and 386 environment |
| `release` | `release` checks code style and coverage, builds the agent and also packages it into a RPM, DEB and ZIP package |
| `build-release` | `build-release` checks code style and coverage, builds the agent and also packages it into a RPM, DEB and ZIP package |
| `release` | `release` checks code style and coverage, runs tests, packages all dependencies to the bin folder. |
| `package` | `package` packages build result into a RPM, DEB and ZIP package |
| `pre-build` | `pre-build` goes through Tools/src folder to make sure all the script files are executable |
| `checkstyle` | `checkstyle` runs the checkstyle script |
Expand Down
4 changes: 3 additions & 1 deletion Tools/src/create_darwin.sh
@@ -1,4 +1,6 @@
#!/usr/bin/env bash
set -e

echo "****************************************"
echo "Creating tar file for Mac OS X amd64 "
echo "****************************************"
Expand Down Expand Up @@ -34,7 +36,7 @@ chmod 600 ${ROOTFS}/Library/LaunchDaemons/*
echo "Creating tar"
(
cd ${ROOTFS}
gtar czf $TAR_NAME * --owner=0 --group=0
tar czf $TAR_NAME * --owner=0 --group=0
)

echo "Moving tar"
Expand Down
4 changes: 3 additions & 1 deletion makefile
Expand Up @@ -53,7 +53,9 @@ prepack:: cpy-plugins copy-win-dep prepack-linux prepack-linux-arm64 prepack-lin

package:: create-package-folder package-linux package-windows package-darwin

release:: clean quick-integtest checkstyle pre-release build prepack package finalize
build-release:: clean quick-integtest checkstyle pre-release build prepack package finalize

release:: clean quick-integtest checkstyle pre-release cpy-plugins copy-win-dep finalize

package-src:: clean quick-integtest checkstyle pre-release cpy-plugins finalize

Expand Down

0 comments on commit d340af9

Please sign in to comment.