-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into release/v0.1
- Loading branch information
Showing
215 changed files
with
16,335 additions
and
7,353 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: "Build GARM images" | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
push_to_project: | ||
description: "Project to build images for" | ||
required: true | ||
default: "ghcr.io/cloudbase" | ||
ref: | ||
description: "Ref to build" | ||
required: true | ||
default: "main" | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
images: | ||
permissions: | ||
packages: write | ||
name: "Build GARM images" | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: "Checkout" | ||
uses: actions/checkout@v3 | ||
with: | ||
path: src/github.com/cloudbase/garm | ||
fetch-depth: 0 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push | ||
run: | | ||
cd src/github.com/cloudbase/garm | ||
VERSION=$(git describe --tags --match='v[0-9]*' --always ${{ github.event.inputs.ref }}) | ||
docker buildx build \ | ||
--provenance=false \ | ||
--platform linux/amd64,linux/arm64 \ | ||
--build-arg="GARM_REF=${{ github.event.inputs.ref }}" \ | ||
-t ${{ github.event.inputs.push_to_project }}/garm:"${VERSION}" \ | ||
--push . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,29 @@ | ||
FROM docker.io/golang:alpine | ||
FROM docker.io/golang:alpine AS builder | ||
ARG GARM_REF | ||
|
||
WORKDIR /root | ||
USER root | ||
LABEL stage=builder | ||
|
||
RUN apk add musl-dev gcc libtool m4 autoconf g++ make libblkid util-linux-dev git linux-headers mingw-w64-gcc | ||
RUN apk add musl-dev gcc libtool m4 autoconf g++ make libblkid util-linux-dev git linux-headers | ||
RUN git config --global --add safe.directory /build | ||
|
||
ADD ./scripts/build-static.sh /build-static.sh | ||
RUN chmod +x /build-static.sh | ||
ADD . /build/garm | ||
RUN cd /build/garm && git checkout ${GARM_REF} | ||
RUN git clone https://github.com/cloudbase/garm-provider-azure /build/garm-provider-azure | ||
RUN git clone https://github.com/cloudbase/garm-provider-openstack /build/garm-provider-openstack | ||
|
||
CMD ["/bin/sh"] | ||
RUN cd /build/garm && go build -o /bin/garm \ | ||
-tags osusergo,netgo,sqlite_omit_load_extension \ | ||
-ldflags "-linkmode external -extldflags '-static' -s -w -X main.Version=$(git describe --tags --match='v[0-9]*' --dirty --always)" \ | ||
/build/garm/cmd/garm | ||
RUN mkdir -p /opt/garm/providers.d | ||
RUN cd /build/garm-provider-azure && go build -ldflags="-linkmode external -extldflags '-static' -s -w" -o /opt/garm/providers.d/garm-provider-azure . | ||
RUN cd /build/garm-provider-openstack && go build -ldflags="-linkmode external -extldflags '-static' -s -w" -o /opt/garm/providers.d/garm-provider-openstack . | ||
|
||
FROM scratch | ||
|
||
COPY --from=builder /bin/garm /bin/garm | ||
COPY --from=builder /opt/garm/providers.d/garm-provider-openstack /opt/garm/providers.d/garm-provider-openstack | ||
COPY --from=builder /opt/garm/providers.d/garm-provider-azure /opt/garm/providers.d/garm-provider-azure | ||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ | ||
|
||
ENTRYPOINT ["/bin/garm", "-config", "/etc/garm/config.toml"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM docker.io/golang:alpine | ||
|
||
WORKDIR /root | ||
USER root | ||
|
||
RUN apk add musl-dev gcc libtool m4 autoconf g++ make libblkid util-linux-dev git linux-headers mingw-w64-gcc | ||
|
||
RUN wget http://musl.cc/aarch64-linux-musl-cross.tgz -O /tmp/aarch64-linux-musl-cross.tgz && \ | ||
tar --strip-components=1 -C /usr/local -xzf /tmp/aarch64-linux-musl-cross.tgz && \ | ||
rm /tmp/aarch64-linux-musl-cross.tgz | ||
|
||
ADD ./scripts/build-static.sh /build-static.sh | ||
RUN chmod +x /build-static.sh | ||
|
||
CMD ["/bin/sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.