Skip to content

Commit

Permalink
#1673 #1672 Update Docker for CircleCI builds (#2030)
Browse files Browse the repository at this point in the history
* version 8.21.0

* New 8.23 version with `dotnet dev-certs` command

* Publish `latest` and `8.23.2` tags
  • Loading branch information
raman-m authored Apr 3, 2024
1 parent 7cc6f9b commit d1855cb
Show file tree
Hide file tree
Showing 10 changed files with 92 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ orbs:
jobs:
build:
docker:
- image: ocelot2/circleci-build:8.21.0
- image: ocelot2/circleci-build:latest
steps:
- checkout
- run: dotnet tool restore && dotnet cake
release:
docker:
- image: ocelot2/circleci-build:8.21.0
- image: ocelot2/circleci-build:latest
steps:
- checkout
- run: dotnet tool restore && dotnet cake --target=Release
Expand Down
16 changes: 16 additions & 0 deletions docker/8.21.0/Dockerfile.base
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine

RUN apk add bash icu-libs krb5-libs libgcc libintl libssl1.1 libstdc++ zlib git openssh-client

RUN curl -L --output ./dotnet-install.sh https://dot.net/v1/dotnet-install.sh

RUN chmod u+x ./dotnet-install.sh

# Install .NET 8 SDK (already included in the base image, but listed for consistency)
RUN ./dotnet-install.sh -c 8.0 -i /usr/share/dotnet

# Install .NET 7 SDK
RUN ./dotnet-install.sh -c 7.0 -i /usr/share/dotnet

# Install .NET 6 SDK
RUN ./dotnet-install.sh -c 6.0 -i /usr/share/dotnet
17 changes: 17 additions & 0 deletions docker/8.21.0/Dockerfile.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# call from ocelot repo root with
# docker build --platform linux/arm64 --build-arg OCELOT_COVERALLS_TOKEN=$OCELOT_COVERALLS_TOKEN -f ./docker/Dockerfile.build .
# docker build --platform linux/amd64 --build-arg OCELOT_COVERALLS_TOKEN=$OCELOT_COVERALLS_TOKEN -f ./docker/Dockerfile.build .

FROM ocelot2/circleci-build:8.21.0

ARG OCELOT_COVERALLS_TOKEN

ENV OCELOT_COVERALLS_TOKEN=$OCELOT_COVERALLS_TOKEN

WORKDIR /build

COPY ./. .

RUN dotnet tool restore

RUN dotnet cake
21 changes: 21 additions & 0 deletions docker/8.21.0/Dockerfile.release
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# call from ocelot repo root with
# docker build --platform linux/arm64 --build-arg OCELOT_COVERALLS_TOKEN=$OCELOT_COVERALLS_TOKEN --build-arg OCELOT_GITHUB_API_KEY=$OCELOT_GITHUB_API_KEY --build-arg OCELOT_COVERALLS_TOKEN=$OCELOT_COVERALLS_TOKEN -f ./docker/Dockerfile.build .
# docker build --platform linux/amd64 --build-arg OCELOT_COVERALLS_TOKEN=$OCELOT_COVERALLS_TOKEN --build-arg OCELOT_GITHUB_API_KEY=$OCELOT_GITHUB_API_KEY --build-arg OCELOT_COVERALLS_TOKEN=$OCELOT_COVERALLS_TOKEN -f ./docker/Dockerfile.build .

FROM ocelot2/circleci-build:8.21.0

ARG OCELOT_COVERALLS_TOKEN
ARG OCELOT_NUTGET_API_KEY
ARG OCELOT_GITHUB_API_KEY

ENV OCELOT_COVERALLS_TOKEN=$OCELOT_COVERALLS_TOKEN
ENV OCELOT_NUTGET_API_KEY=$OCELOT_NUTGET_API_KEY
ENV OCELOT_GITHUB_API_KEY=$OCELOT_GITHUB_API_KEY

WORKDIR /build

COPY ./. .

RUN dotnet tool restore

RUN dotnet cake
11 changes: 11 additions & 0 deletions docker/8.21.0/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# This script builds the Ocelot Docker file

# {DotNetSdkVer}.{OcelotVer} -> {.NET8}.{21.0} -> 8.21.0
version=8.21.0
docker build --platform linux/amd64 -t ocelot2/circleci-build -f Dockerfile.base .

echo $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin

docker tag ocelot2/circleci-build ocelot2/circleci-build:$version
docker push ocelot2/circleci-build:latest
docker push ocelot2/circleci-build:$version
11 changes: 10 additions & 1 deletion docker/Dockerfile.base
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine

RUN apk add bash icu-libs krb5-libs libgcc libintl libssl1.1 libstdc++ zlib git openssh-client
RUN apk add bash icu-libs krb5-libs libgcc libintl libssl3 libstdc++ zlib git openssh-client

RUN curl -L --output ./dotnet-install.sh https://dot.net/v1/dotnet-install.sh

Expand All @@ -14,3 +14,12 @@ RUN ./dotnet-install.sh -c 7.0 -i /usr/share/dotnet

# Install .NET 6 SDK
RUN ./dotnet-install.sh -c 6.0 -i /usr/share/dotnet

# Generate and export the development certificate
RUN dotnet dev-certs https -ep /certs/cert.pem -p '' && \
chmod 644 /certs/cert.pem

ENV ASPNETCORE_URLS="https://+;http://+"
ENV ASPNETCORE_HTTPS_PORT=443
ENV ASPNETCORE_Kestrel__Certificates__Default__Password=""
ENV ASPNETCORE_Kestrel__Certificates__Default__Path=/certs/cert.pem
2 changes: 1 addition & 1 deletion docker/Dockerfile.build
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# docker build --platform linux/arm64 --build-arg OCELOT_COVERALLS_TOKEN=$OCELOT_COVERALLS_TOKEN -f ./docker/Dockerfile.build .
# docker build --platform linux/amd64 --build-arg OCELOT_COVERALLS_TOKEN=$OCELOT_COVERALLS_TOKEN -f ./docker/Dockerfile.build .

FROM ocelot2/circleci-build:8.21.0
FROM ocelot2/circleci-build:latest

ARG OCELOT_COVERALLS_TOKEN

Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile.release
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# docker build --platform linux/arm64 --build-arg OCELOT_COVERALLS_TOKEN=$OCELOT_COVERALLS_TOKEN --build-arg OCELOT_GITHUB_API_KEY=$OCELOT_GITHUB_API_KEY --build-arg OCELOT_COVERALLS_TOKEN=$OCELOT_COVERALLS_TOKEN -f ./docker/Dockerfile.build .
# docker build --platform linux/amd64 --build-arg OCELOT_COVERALLS_TOKEN=$OCELOT_COVERALLS_TOKEN --build-arg OCELOT_GITHUB_API_KEY=$OCELOT_GITHUB_API_KEY --build-arg OCELOT_COVERALLS_TOKEN=$OCELOT_COVERALLS_TOKEN -f ./docker/Dockerfile.build .

FROM ocelot2/circleci-build:8.21.0
FROM ocelot2/circleci-build:latest

ARG OCELOT_COVERALLS_TOKEN
ARG OCELOT_NUTGET_API_KEY
Expand Down
11 changes: 11 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# docker build

This folder contains the `Dockerfile.*` and `build.sh` script to create the Ocelot build image & container.

## Account
- [Ocelot Gateway Profile | Docker Hub](https://hub.docker.com/u/ocelot2)

## Repositories
- [circleci-build](https://hub.docker.com/r/ocelot2/circleci-build)

## ocelot2/circleci-build Tags
- [latest](https://hub.docker.com/layers/ocelot2/circleci-build/latest/images/sha256-981d6f9e6e5ba54f6e044bca6fcf8b5197a8f3e6ce2b3cdfa9e6704ecd2ca969?context=explore) is version 8.23.2, uploaded on Apr 3, 2024.
- [8.23.2](https://hub.docker.com/layers/ocelot2/circleci-build/8.23.2/images/sha256-981d6f9e6e5ba54f6e044bca6fcf8b5197a8f3e6ce2b3cdfa9e6704ecd2ca969?context=explore), uploaded on Apr 3, 2024. It supports development SSL certificates by the command `dotnet dev-certs https`.
- [8.21.0](https://hub.docker.com/layers/ocelot2/circleci-build/8.21.0/images/sha256-edb46d37ab52d39a5b27dc63895e5944d4d491d1788744ed144ecb4303b94532?context=explore), uploaded on Nov 20, 2023. It contains .NET 8, 7 and 6 SDKs. It supports builds for `net6.0`, `net7.0` and `net8.0` frameworks.
4 changes: 2 additions & 2 deletions docker/build.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This script builds the Ocelot Docker file

# {DotNetSdkVer}.{OcelotVer} -> {.NET8}.{21.0} -> 8.21.0
version=8.21.0
# {DotNetSdkVer}.{OcelotVer} -> {.NET8}.{23.2} -> 8.23.2
version=8.23.2
docker build --platform linux/amd64 -t ocelot2/circleci-build -f Dockerfile.base .

echo $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin
Expand Down

0 comments on commit d1855cb

Please sign in to comment.