Skip to content

Commit

Permalink
✨ Upgrade aws s3 v2 (#369)
Browse files Browse the repository at this point in the history
  • Loading branch information
tosone authored Jun 10, 2024
1 parent 41b49e9 commit 95816e7
Show file tree
Hide file tree
Showing 13 changed files with 1,333 additions and 627 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ all: build build-builder

## Build:
build: ## Build sigma and put the output binary in ./bin
@CGO_ENABLED=1 GO111MODULE=on CC="$(CC)" CXX="$(CXX)" $(GOCMD) build $(GOFLAGS) -tags "timetzdata,exclude_graphdriver_devicemapper,exclude_graphdriver_btrfs,containers_image_openpgp" -o bin/$(BINARY_NAME) -v .
@CGO_ENABLED=0 GO111MODULE=on CC="$(CC)" CXX="$(CXX)" $(GOCMD) build $(GOFLAGS) -tags "timetzdata,exclude_graphdriver_devicemapper,exclude_graphdriver_btrfs,containers_image_openpgp" -o bin/$(BINARY_NAME) -v .

build-builder: ## Build sigma-builder and put the output binary in ./bin
@CGO_ENABLED=0 GO111MODULE=on CC="$(CC)" CXX="$(CXX)" $(GOCMD) build $(GOFLAGS) -tags "timetzdata,exclude_graphdriver_devicemapper,exclude_graphdriver_btrfs,containers_image_openpgp" -o bin/$(BINARY_NAME)-builder -v ./cmd/builder
Expand Down Expand Up @@ -78,7 +78,7 @@ endif
docker run --rm -it -v $(shell pwd):/data cytopia/yamllint -f parsable $(shell git ls-files '*.yml' '*.yaml') $(OUTPUT_OPTIONS)

## Docker:
docker-build: docker-build-builder-local dockerfile-local ## Use the dockerfile to build the sigma image
docker-build: #docker-build-builder-local dockerfile-local ## Use the dockerfile to build the sigma image
docker buildx build --build-arg USE_MIRROR=$(USE_MIRROR) --build-arg WITH_TRIVY_DB=$(WITH_TRIVY_DB) -f build/Dockerfile --platform $(DOCKER_PLATFORMS) --progress plain --output type=docker,name=$(DOCKER_REGISTRY)/$(BINARY_NAME):latest,push=false,oci-mediatypes=true,compression=zstd,compression-level=12,force-compression=true .

docker-build-builder: ## Use the dockerfile to build the sigma-builder image
Expand Down
19 changes: 5 additions & 14 deletions build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG GOLANG_VERSION=1.22.2-alpine3.19
ARG GOLANG_VERSION=1.22.4-alpine3.19
ARG NODE_VERSION=20-alpine3.19
ARG ALPINE_VERSION=3.19

Expand All @@ -18,7 +18,7 @@ RUN --mount=type=cache,target=/web/node_modules set -eux && corepack enable && y

FROM alpine:${ALPINE_VERSION} as syft

ARG SYFT_VERSION=1.0.1
ARG SYFT_VERSION=1.5.0
ARG TARGETOS TARGETARCH
ARG USE_MIRROR=false

Expand All @@ -34,7 +34,7 @@ FROM alpine:${ALPINE_VERSION} as trivy

ARG USE_MIRROR=false
ARG WITH_TRIVY_DB=false
ARG TRIVY_VERSION=0.50.4
ARG TRIVY_VERSION=0.52.0
ARG TARGETOS TARGETARCH

SHELL ["/bin/ash", "-eo", "pipefail", "-c"]
Expand Down Expand Up @@ -75,8 +75,7 @@ ARG USE_MIRROR=false

RUN set -eux && \
if [ "$USE_MIRROR" = true ]; then sed -i "s/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g" /etc/apk/repositories; fi && \
apk add --no-cache make bash ncurses build-base git openssl linux-headers && \
apk add --no-cache zig --repository=https://mirrors.aliyun.com/alpine/edge/community
apk add --no-cache make bash ncurses build-base git openssl linux-headers

COPY . /go/src/github.com/go-sigma/sigma
COPY --from=web-builder /web/dist /go/src/github.com/go-sigma/sigma/web/dist
Expand All @@ -86,15 +85,7 @@ WORKDIR /go/src/github.com/go-sigma/sigma
ARG TARGETOS TARGETARCH

RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build \
# case "${TARGETARCH}" in \
# amd64) export CC="zig cc -target x86_64-linux-musl" ;; \
# arm64) export CC="zig cc -target aarch64-linux-musl" ;; \
# esac; \
# case "${TARGETARCH}" in \
# amd64) export CXX="zig c++ -target x86_64-linux-musl" ;; \
# arm64) export CXX="zig c++ -target aarch64-linux-musl" ;; \
# esac; \
GOOS=$TARGETOS GOARCH=$TARGETARCH CC="${CC}" CXX="${CXX}" make build
GOOS=$TARGETOS GOARCH=$TARGETARCH make build

FROM alpine:${ALPINE_VERSION}

Expand Down
17 changes: 4 additions & 13 deletions build/Dockerfile.builder
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
ARG GOLANG_VERSION=1.22.2-alpine3.19
ARG GOLANG_VERSION=1.22.4-alpine3.19
ARG BUILDKIT_VERSION=v0.13.2-rootless
ARG ALPINE_VERSION=3.19

FROM alpine:${ALPINE_VERSION} as cosign

ARG USE_MIRROR=false
ARG COSIGN_VERSION=v2.2.2
ARG COSIGN_VERSION=v2.2.4
ARG TARGETOS TARGETARCH

RUN set -eux && \
Expand All @@ -20,24 +20,15 @@ ARG USE_MIRROR=false

RUN set -eux && \
if [ "$USE_MIRROR" = true ]; then sed -i "s/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g" /etc/apk/repositories; fi && \
apk add --no-cache make bash ncurses build-base git openssl && \
apk add --no-cache zig --repository=https://mirrors.aliyun.com/alpine/edge/community
apk add --no-cache make bash ncurses build-base git openssl

COPY . /go/src/github.com/go-sigma/sigma
WORKDIR /go/src/github.com/go-sigma/sigma

ARG TARGETOS TARGETARCH

RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build \
case "${TARGETARCH}" in \
amd64) export CC="zig cc -target x86_64-linux-musl" ;; \
arm64) export CC="zig cc -target aarch64-linux-musl" ;; \
esac; \
case "${TARGETARCH}" in \
amd64) export CXX="zig c++ -target x86_64-linux-musl" ;; \
arm64) export CXX="zig c++ -target aarch64-linux-musl" ;; \
esac; \
GOOS=$TARGETOS GOARCH=$TARGETARCH CC="${CC}" CXX="${CXX}" make build-builder
GOOS=$TARGETOS GOARCH=$TARGETARCH make build-builder

FROM moby/buildkit:${BUILDKIT_VERSION}

Expand Down
27 changes: 5 additions & 22 deletions build/Dockerfile.debian
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG GOLANG_VERSION=1.22.2-bookworm
ARG GOLANG_VERSION=1.22.4-bookworm
ARG NODE_VERSION=20-alpine3.19
ARG ALPINE_VERSION=3.19
ARG DEBIAN_VERSION=bookworm-slim
Expand All @@ -20,7 +20,7 @@ RUN --mount=type=cache,target=/web/node_modules set -eux && corepack enable && y
FROM alpine:${ALPINE_VERSION} as syft

ARG USE_MIRROR=false
ARG SYFT_VERSION=1.0.1
ARG SYFT_VERSION=1.5.0
ARG TARGETOS TARGETARCH

RUN set -eux && \
Expand All @@ -35,7 +35,7 @@ FROM alpine:${ALPINE_VERSION} as trivy

ARG USE_MIRROR=false
ARG WITH_TRIVY_DB=false
ARG TRIVY_VERSION=0.50.4
ARG TRIVY_VERSION=0.52.0
ARG TARGETOS TARGETARCH

RUN set -eux && \
Expand Down Expand Up @@ -89,16 +89,7 @@ RUN set -eux && \
wget \
xz-utils \
&& \
rm -rf /var/lib/apt/lists/* && \
case "${BUILDARCH}" in \
amd64) export ZIGARCH='x86_64' ;; \
arm64) export ZIGARCH='aarch64' ;; \
esac; \
wget -O zig-linux-"${ZIGARCH}"-"${ZIG_VERSION}".tar.xz https://ziglang.org/download/"${ZIG_VERSION}"/zig-linux-"${ZIGARCH}"-"${ZIG_VERSION}".tar.xz && \
tar xf zig-linux-"${ZIGARCH}"-"${ZIG_VERSION}".tar.xz && \
mv ./zig-linux-"${ZIGARCH}"-"${ZIG_VERSION}"/zig /usr/local/bin && \
mv ./zig-linux-"${ZIGARCH}"-"${ZIG_VERSION}"/lib /usr/local/bin && \
rm -rf ./zig-linux-"${ZIGARCH}"-"${ZIG_VERSION}" zig-linux-"${ZIGARCH}"-"${ZIG_VERSION}".tar.xz
rm -rf /var/lib/apt/lists/*

COPY . /go/src/github.com/go-sigma/sigma
COPY --from=web-builder /web/dist /go/src/github.com/go-sigma/sigma/web/dist
Expand All @@ -108,15 +99,7 @@ WORKDIR /go/src/github.com/go-sigma/sigma
ARG TARGETOS TARGETARCH

RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build \
# case "${TARGETARCH}" in \
# amd64) export CC="zig cc -target x86_64-linux-musl" ;; \
# arm64) export CC="zig cc -target aarch64-linux-musl" ;; \
# esac; \
# case "${TARGETARCH}" in \
# amd64) export CXX="zig c++ -target x86_64-linux-musl" ;; \
# arm64) export CXX="zig c++ -target aarch64-linux-musl" ;; \
# esac; \
GOOS=$TARGETOS GOARCH=$TARGETARCH CC="${CC}" CXX="${CXX}" make build
GOOS=$TARGETOS GOARCH=$TARGETARCH make build

FROM debian:${DEBIAN_VERSION}

Expand Down
Loading

0 comments on commit 95816e7

Please sign in to comment.