Skip to content

Commit

Permalink
Dockerfile.windows: escape quotes properly for GO_TAGS environment va…
Browse files Browse the repository at this point in the history
…riable (#763)

* Dockerfile.windows: escape quotes

Using single quotes led to recursive variable definitions in Make, while
double quotes caused the build to fail. To work around this, escaped
double quotes must be used.

* ci: add test to build Docker images
  • Loading branch information
rfratto authored May 3, 2024
1 parent 1410a70 commit 577ea1f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
31 changes: 31 additions & 0 deletions .github/workflows/docker-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Check Docker images

on:
pull_request:
paths:
- Dockerfile
- Dockerfile.windows
- Makefile
- 'tools/make/*'

jobs:
# NOTE(rfratto): We only test building the Docker images for the host
# platform, but we're really only looking for issues that are
# architecture-independent.
linux:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Build image
run: |
docker build -t alloy-test:latest -f Dockerfile .
windows:
runs-on: windows-2019
steps:
- uses: actions/checkout@v4
- name: Build image
run: |
docker build -t alloy-test:latest -f Dockerfile.windows .
2 changes: 1 addition & 1 deletion Dockerfile.windows
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ SHELL ["cmd", "/S", "/C"]
# 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 ${GO_TAGS}' make alloy""
RUN ""C:\Program Files\git\bin\bash.exe" -c "RELEASE_BUILD=${RELEASE_BUILD} VERSION=${VERSION} GO_TAGS=\"builtinassets ${GO_TAGS}\" make alloy""
# In this case, we're separating the clean command from make alloy to avoid an issue where access to some mod cache
# files is denied immediately after make alloy, for example:
# "go: remove C:\go\pkg\mod\golang.org\[email protected]\bin\go.exe: Access is denied."
Expand Down

0 comments on commit 577ea1f

Please sign in to comment.