Skip to content

Commit

Permalink
[CONSUL-207] Move base Dockerfiles to build-support-windows folder (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
cocolavayen authored and joselo85 committed Dec 21, 2022
1 parent dea9dd8 commit e93feee
Show file tree
Hide file tree
Showing 7 changed files with 105 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,18 @@ docker.exe pull mcr.microsoft.com/windows/nanoserver:1809
# Re tag Pulled image
docker.exe tag mcr.microsoft.com/windows/nanoserver:1809 "${HASHICORP_DOCKER_PROXY}/windows/nanoserver"

# Build Fortio Windows Image
docker.exe build -t "${HASHICORP_DOCKER_PROXY}/windows/fortio" -f Dockerfile-fortio-windows .

# Pull Envoy-Windows Image
docker.exe pull "envoyproxy/envoy-windows:v${ENVOY_VERSION}"
# Re tag Pulled image
docker.exe tag "envoyproxy/envoy-windows:v${ENVOY_VERSION}" "${HASHICORP_DOCKER_PROXY}/windows/envoy-windows:v${ENVOY_VERSION}"

# Build Fortio Windows Image
docker.exe build -t "${HASHICORP_DOCKER_PROXY}/windows/fortio" -f Dockerfile-fortio-windows .

# Build Socat-Windows Image
docker.exe build -t "${HASHICORP_DOCKER_PROXY}/windows/socat" -f Dockerfile-socat-windows .

# Build Bats-Core-Windows Image
docker build -t "${HASHICORP_DOCKER_PROXY}/windows/bats:1.7.0" . -f Dockerfile-bats-core-windows

echo "Building Complete!"
94 changes: 94 additions & 0 deletions build-support-windows/docker.windows.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Dockerfiles for Windows Integration Tests

## Index

- [About](#about-this-file)
- [Dockerfile-fortio-windows](#dockerfile-fortio-windows)
- [Dockerfile-socat-windows](#dockerfile-socat-windows)
- [Dockerfile-bats-core-windows](#dockerfile-bats-core-windows)
- [Build images](#build-images)

## About this File

In this file you will find which Docker images that need to be pre-built to run the Envoy integration tests on Windows, as well as information on how to run each of these files individually for testing purposes.

## Dockerfile-fortio-windows

This file sole purpose is to build the custom Fortio image for Windows OS. To do this, the official [windows/nanoserver image](https://hub.docker.com/_/microsoft-windows-nanoserver) is used as base image.
To build this image you need to run the following command on your terminal:

```shell
docker build -t fortio . -f Dockerfile-fortio-windows
```

This is the same command used in run-tests.sh

You can test the built file by running the following command:

```shell
docker run --rm -p 8080:8080 --name fortio fortio
```

If everything works properly you should openning the browser and check that the Fortio server running on: `http://localhost:8080/fortio`

## Dockerfile-socat-windows

The alpine:socat image was replaced by a windows core image to which a precompiled version of Socat was installed.

The windows base used was: `mcr.microsoft.com/windows/servercore:1809`

The compiled windows version of Socat can be found in the repository [https://github.com/tech128/socat-1.7.3.0-windows](https://github.com/tech128/socat-1.7.3.0-windows)

To build this image you need to run the following command on your terminal:

```shell
docker build -t socat -f Dockerfile-socat-windows .
```

You can test the built file by running the following command:

```shell
docker run --rm --name socat socat
```

If everything works properly you should get the following output:

```shell
20XX/XX/XX XX:XX:XX socat[1292] E exactly 2 addresses required (there are 0); use option "-h" for help
```

## Dockerfile-bats-core-windows

This file sole purpose is to build the custom Bats image for Windows OS. To do this, the official [windows/servercore image](https://hub.docker.com/_/microsoft-windows-servercore) is used as base image.
To build this image you need to run the following command on your terminal:

```shell
docker build -t bats-verify . -f Dockerfile-bats-windows
```

This is the same command used in run-tests.sh

You can test the built file by running the following command:

```shell
docker run --rm --name bats-verify bats-verify
```

If everything works properly you should see the help commands and available parameters about how to run Bats tests like is displayed below

```shell
$ docker run --rm --name bats-verify bats-verify
Usage: bats [OPTIONS] <tests>
bats [-h | -v]

<tests> is the path to a Bats test file, or the path to a directory
containing Bats test files (ending with ".bats")
```

## Build images

To build the images, it is necessary to open a Git bash terminal and run

```
./build-images.sh
```
51 changes: 4 additions & 47 deletions test/integration/connect/envoy/docker.windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@
## Index

- [About](#about-this-file)
- [Pre-requisites](#pre-requisites)
- [Dockerfile-test-sds-server-windows](#dockerfile-test-sds-server-windows)
- [Dockerfile-fortio-windows](#dockerfile-fortio-windows)
- [Dockerfile-socat-windows](#dockerfile-socat-windows)
- [Dockerfile-bats-windows](#dockerfile-bats-windows)

## About this File

In this file you will find which Dockerfiles are needed to run the Envoy integration tests on Windows, as well as information on how to run each of these files individually for testing purposes.

## Pre-requisites
After building and running the images and containers, you need to have pre-built the base images used by these Dockerfiles. See [pre-built images required in Windows](../../../../build-support-windows/docker.windows.md)

## Dockerfile-test-sds-server-windows

This file sole purpose is to build the test-sds-server executable using Go. To do so, we use an official [golang image](https://hub.docker.com/_/golang/) provided in docker hub with Windows nano server.
Expand Down Expand Up @@ -39,51 +41,6 @@ If everything works properly you should get the following output:
20XX-XX-XXTXX:XX:XX.XXX-XXX [INFO] ==> SDS listening: addr=0.0.0.0:1234
```

## Dockerfile-fortio-windows

This file sole purpose is to build the custom Fortio image for Windows OS. To do this, the official [windows/nanoserver image](https://hub.docker.com/_/microsoft-windows-nanoserver) is used as base image.
To build this image you need to run the following command on your terminal:

```shell
docker build -t fortio . -f Dockerfile-fortio-windows
```

This is the same command used in run-tests.sh

You can test the built file by running the following command:

```shell
docker run --rm -p 8080:8080 --name fortio fortio
```

If everything works properly you should openning the browser and check that the Fortio server running on: `http://localhost:8080/fortio`

## Dockerfile-socat-windows

The alpine:socat image was replaced by a windows core image to which a precompiled version of Socat was installed.

The windows base used was: `mcr.microsoft.com/windows/servercore:1809`

The compiled windows version of Socat can be found in the repository [https://github.com/tech128/socat-1.7.3.0-windows](https://github.com/tech128/socat-1.7.3.0-windows)

To build this image you need to run the following command on your terminal:

```shell
docker build -t socat -f Dockerfile-socat-windows .
```

You can test the built file by running the following command:

```shell
docker run --rm --name socat socat
```

If everything works properly you should get the following output:

```shell
20XX/XX/XX XX:XX:XX socat[1292] E exactly 2 addresses required (there are 0); use option "-h" for help
```

## Dockerfile-bats-windows

This file sole purpose is to build the custom Bats image for Windows OS. To do this, the official [windows/servercore image](https://hub.docker.com/_/microsoft-windows-servercore) is used as base image.
Expand Down
2 changes: 1 addition & 1 deletion test/integration/connect/envoy/run-tests.windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ function suite_setup {
# pre-build the verify container
echo "Rebuilding 'bats-verify' image..."
# TODO -Line below commented for testing
# docker build -t bats-verify -f Dockerfile-bats-windows .
docker build -t bats-verify -f Dockerfile-bats-windows .

# if this fails on CircleCI your first thing to try would be to upgrade
# the machine image to the latest version using this listing:
Expand Down

0 comments on commit e93feee

Please sign in to comment.