Skip to content

Commit

Permalink
#91: Build win binary in linux image
Browse files Browse the repository at this point in the history
  • Loading branch information
roma-glushko committed Apr 28, 2024
1 parent 36d30c1 commit ee5526f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
16 changes: 14 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,20 @@ You can outline gaps and let other people contribute their ideas on possible sol
### Dev Commands

Many useful commands are in [the root makefile](Makefile).
We use make as a convenient interface to automate a bunch of commands like codebase linting, running tests, running dev binary, etc.
Be sure to take a look at all available commands.

> [!Warning]
> Windows doesn't come with `make` installed. You need to install it via [Chocolatey](https://chocolatey.org/), for example:
> ```powershell
> choco install make
> ```
We use make as a convenient interface to automate a bunch of commands like:
- codebase linting via `make lint`
- running tests via `make test`
- running dev binary `make run`
- etc.
Be sure to take a look at all available commands via running `make` (from the project root directory).
### CI Checks
Expand Down
7 changes: 4 additions & 3 deletions images/windowserver.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:1
FROM golang:1.22-windowsservercore-1809 as build
FROM golang:1.22-alpine as build

ARG VERSION
ARG COMMIT
Expand All @@ -9,15 +9,16 @@ ENV GOOS=windows

WORKDIR /build

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

COPY . /build/
RUN go mod download
RUN go build -v -o /build/dist/glide.exe -ldflags "-s -w -X glide/pkg/version.Version="$VERSION" -X glide/pkg/version.commitSha="$COMMIT" -X glide/pkg/version.buildDate="$BUILD_DATE""

FROM mcr.microsoft.com/windows/servercore:1809 as release

WORKDIR /bin

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

COPY --from=build /build/dist/glide.exe /bin/

ENTRYPOINT ["/bin/glide.exe"]

0 comments on commit ee5526f

Please sign in to comment.