Skip to content

Commit

Permalink
Cartservice debug profile + Dockerfile.debug (GoogleCloudPlatform#571)
Browse files Browse the repository at this point in the history
* suse dotnet binary to start cartservice so its debugable

* use dockerfile.debug

* readd newline

* update skaffold.yaml copyright

* kelsey PR changes
  • Loading branch information
j-windsor authored Jul 14, 2021
1 parent efeba9e commit d848308
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 3 deletions.
17 changes: 15 additions & 2 deletions skaffold.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2018 Google LLC
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: skaffold/v1beta2
apiVersion: skaffold/v2beta1
kind: Config
build:
artifacts:
Expand All @@ -36,6 +36,8 @@ build:
context: src/currencyservice
- image: cartservice
context: src/cartservice/src
docker:
dockerfile: Dockerfile
- image: frontend
context: src/frontend
- image: loadgenerator
Expand Down Expand Up @@ -65,3 +67,14 @@ profiles:
diskSizeGb: 300
machineType: N1_HIGHCPU_32
timeout: 4000s
# "debug" profile replaces the default Dockerfile in cartservice with Dockerfile.debug,
# which enables debugging via skaffold.
#
# This profile is used by default when running skaffold debug.
- name: debug
activation:
- command: debug
patches:
- op: replace
path: /build/artifacts/7/docker/dockerfile
value: Dockerfile.debug
2 changes: 1 addition & 1 deletion src/cartservice/src/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 Google LLC
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
36 changes: 36 additions & 0 deletions src/cartservice/src/Dockerfile.debug
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# 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.

FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /app
COPY . .
RUN dotnet restore cartservice.csproj
RUN dotnet build "./cartservice.csproj" -c Debug -o /out

FROM build AS publish
RUN dotnet publish cartservice.csproj -c Debug -o /out

# Building final image used in running container
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS final
# Installing procps on the container to enable debugging of .NET Core
RUN apt-get update \
&& apt-get install -y unzip procps wget
RUN GRPC_HEALTH_PROBE_VERSION=v0.3.6 && \
wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-amd64 && \
chmod +x /bin/grpc_health_probe
WORKDIR /app
COPY --from=publish /out .
ENV ASPNETCORE_URLS=http://*:7070

ENTRYPOINT ["dotnet", "cartservice.dll"]

0 comments on commit d848308

Please sign in to comment.