Skip to content

Commit

Permalink
operator: allow bundle atlas with given version
Browse files Browse the repository at this point in the history
  • Loading branch information
giautm committed Feb 6, 2024
1 parent 0baf768 commit ff25ba1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/push-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,18 @@ jobs:
org.opencontainers.image.url=https://atlasgo.io
org.opencontainers.image.vendor=Ariga
org.opencontainers.image.source=https://github.com/ariga/atlas-operator/blob/master/Dockerfile
- name: Fetch Atlas version
id: atlas
run: |
# All distributions are built from the same version
# so we only need to fetch it once.
echo "::set-output name=version::$(curl -s https://release.ariga.io/atlas/atlas-linux-amd64-latest.version)"
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
build-args: |
ATLAS_VERSION=${{ steps.atlas.outputs.version }}
OPERATOR_VERSION=v${{ steps.meta.outputs.version }}
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
Expand All @@ -73,4 +80,4 @@ jobs:
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: 'trivy-results.sarif'
sarif_file: 'trivy-results.sarif'
18 changes: 11 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.

# Build the manager binary
FROM golang:1.21.5-alpine as builder
FROM golang:1.21.6-alpine3.19 as builder
ARG TARGETOS
ARG TARGETARCH
ARG OPERATOR_VERSION
Expand All @@ -37,16 +37,20 @@ COPY internal/ internal/

RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build \
-ldflags "-X 'main.version=${OPERATOR_VERSION}'" \
-a -o manager main.go
GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} CGO_ENABLED=0 \
go build -ldflags "-X 'main.version=${OPERATOR_VERSION}'" \
-o manager -a main.go

FROM arigaio/atlas:latest-alpine as atlas
FROM alpine:3.19 as atlas
RUN apk add --no-cache curl
ARG ATLAS_VERSION=latest
ENV ATLAS_VERSION=${ATLAS_VERSION}
RUN curl -sSf https://atlasgo.sh | sh

FROM alpine:3.19.0
FROM alpine:3.19
WORKDIR /
COPY --from=builder /workspace/manager .
COPY --from=atlas /atlas .
COPY --from=atlas /usr/local/bin/atlas .
RUN chmod +x /atlas
ENV ATLAS_NO_UPDATE_NOTIFIER=1
ENV ATLAS_KUBERNETES_OPERATOR=1
Expand Down

0 comments on commit ff25ba1

Please sign in to comment.