Skip to content

Commit

Permalink
Attempt to fix main: separate clean in windows docker images (#6671)
Browse files Browse the repository at this point in the history
  • Loading branch information
thampiotr authored Mar 13, 2024
1 parent 62f8337 commit 954f411
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
7 changes: 6 additions & 1 deletion cmd/grafana-agent/Dockerfile.windows
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ SHELL ["cmd", "/S", "/C"]
# Creating new layers can be really slow on Windows so we clean up any caches
# we can before moving on to the next step.
RUN ""C:\Program Files\git\bin\bash.exe" -c "RELEASE_BUILD=${RELEASE_BUILD} VERSION=${VERSION} make generate-ui && rm -rf web/ui/node_modules && yarn cache clean --all""
RUN ""C:\Program Files\git\bin\bash.exe" -c "RELEASE_BUILD=${RELEASE_BUILD} VERSION=${VERSION} GO_TAGS='builtinassets' make agent && go clean -cache -modcache""

RUN ""C:\Program Files\git\bin\bash.exe" -c "RELEASE_BUILD=${RELEASE_BUILD} VERSION=${VERSION} GO_TAGS='builtinassets' make agent""
# In this case, we're separating the clean command from make agent to avoid an issue where access to some mod cache
# files is denied immediately after make agent, for example:
# "go: remove C:\go\pkg\mod\golang.org\[email protected]\bin\go.exe: Access is denied."
RUN ""C:\Program Files\git\bin\bash.exe" -c "go clean -cache -modcache""

# Use the smallest container possible for the final image
FROM mcr.microsoft.com/windows/nanoserver:1809
Expand Down
8 changes: 5 additions & 3 deletions cmd/grafana-agentctl/Dockerfile.windows
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ WORKDIR /src/agent

SHELL ["cmd", "/S", "/C"]

# Creating new layers can be really slow on Windows so we clean up any caches
# we can before moving on to the next step.
RUN ""C:\Program Files\git\bin\bash.exe" -c "RELEASE_BUILD=${RELEASE_BUILD} VERSION=${VERSION} make agentctl && go clean -cache -modcache""
RUN ""C:\Program Files\git\bin\bash.exe" -c "RELEASE_BUILD=${RELEASE_BUILD} VERSION=${VERSION} make agentctl""
# We're separating the clean command from make agent to avoid an issue where access to some mod cache
# files is denied immediately after make agentctl, for example:
# "go: remove C:\go\pkg\mod\golang.org\[email protected]\bin\go.exe: Access is denied."
RUN ""C:\Program Files\git\bin\bash.exe" -c "go clean -cache -modcache""

# Use the smallest container possible for the final image
FROM mcr.microsoft.com/windows/nanoserver:1809
Expand Down

0 comments on commit 954f411

Please sign in to comment.