
*) echo >&2 "error: unsupported build configuration '$CHIMERA_BUILD_CONFIG'" exit 1 \ \Įcho "echo Starting \$CHIMERA_SERVICE_NAME service in release mode." > /usr/bin/chimera/run.sh \Įcho "/usr/bin/chimera/\$CHIMERA_SERVICE_NAME" > /usr/bin/chimera/run.sh \ Go install -ldflags "-extldflags '-static'" -v. "exec /usr/bin/chimera/\$CHIMERA_SERVICE_NAME" > /usr/bin/chimera/run.sh \ \Įcho "echo Source directory contents:" > /usr/bin/chimera/run.sh \Įcho "ls -li /usr/src/chimera/ echo " > /usr/bin/chimera/run.sh \Įcho "echo Starting \$CHIMERA_SERVICE_NAME service in debug mode." > /usr/bin/chimera/run.sh \Įcho "./dlv -listen=:$CHIMERA_DEBUG_PORT -headless=true -continue" \ Go install -ldflags "-extldflags '-static'" -gcflags "all=-N -l" -v. RUN set -eux case "$CHIMERA_BUILD_CONFIG" in \ RUN set -eux echo "ls -li /usr/bin/chimera/ echo " > /usr/bin/chimera/run.sh RUN set -eux echo "echo Build directory contents:" > /usr/bin/chimera/run.sh RUN set -eux echo "echo Launching Chimera." > /usr/bin/chimera/run.sh RUN set -eux mkdir /usr/bin/chimera echo "#!/bin/bash" > /usr/bin/chimera/run.sh

RUN go install -v go install -ldflags "-extldflags '-static'" -v go.mod.

# container to be inherited by all other builds. # so this step can be skipped for most builds. # Stage 1: Copy and build services and dependencies. # See copyright file at project root for full detailsĪRG CHIMERA_BUILD_CONFIG=$CHIMERA_BUILD_CONFIGĪRG CHIMERA_DEBUG_PORT=$CHIMERA_DEBUG_PORT Get a list of running services to attach your debugger to within Visual Studio Code.Run and attach the delve debugger using dynamic ports and port mappings.Configure services and builds using Docker Compose from Visual Studio Code.Set up a multi-stage build system for a services image.Set up multiple build configurations (debug and release) in docker files.At the end of this article, you’ll know how to: This article outlines how I solved those problems and set up my Go microservices in Docker and Visual Studio Code. I couldn’t find any resources online outlining how to effectively set up a larger microservices project in Docker and Visual Studio Code.

I recently ran into this problem while developing Chimera, my game microservices project running in Docker. Developing microservices in Go can be a fun experience using all of the 12-factor application packages available in the community however, if you can’t debug your services using a sophisticated debugger like delve, then you’re going to experience quite a bit of pain.
