forked from grafana/alloy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.windows
29 lines (22 loc) · 1.45 KB
/
Dockerfile.windows
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
FROM grafana/alloy-build-image:v0.1.6-windows as builder
ARG VERSION
ARG RELEASE_BUILD=1
ARG GO_TAGS
COPY . /src/alloy
WORKDIR /src/alloy
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 ${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\toolchain@v0.0.1-go1.22.3.windows-amd64\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
COPY --from=builder ["/src/alloy/build/alloy", "C:/Program Files/GrafanaLabs/Alloy/alloy.exe"]
COPY --from=builder ["/src/alloy/example-config.alloy", "C:/Program Files/GrafanaLabs/Alloy/config.alloy"]
ENTRYPOINT ["C:/Program Files/GrafanaLabs/Alloy/alloy.exe"]
ENV ALLOY_DEPLOY_MODE=docker
CMD ["run", "C:/Program Files/GrafanaLabs/Alloy/config.alloy", "--storage.path=C:/ProgramData/GrafanaLabs/Alloy/data"]