Skip to content

Commit

Permalink
Merge pull request #124 from bugbounce/build/arm64
Browse files Browse the repository at this point in the history
Add Dockerfile for building arm64 image
  • Loading branch information
FabianKramm authored Jun 7, 2024
2 parents 759f730 + 028d777 commit 5b3b6d2
Show file tree
Hide file tree
Showing 97 changed files with 3,973 additions and 2,093 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
FROM node:16 as builder

COPY --from=golang:1.17 /usr/local/go/ /usr/local/go/

ENV PATH="/usr/local/go/bin:${PATH}"

WORKDIR /workspace
Expand Down
46 changes: 46 additions & 0 deletions Dockerfile.arm64
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Build the manager binary
FROM node:16-bookworm as builder

COPY --from=golang:1.17 /usr/local/go/ /usr/local/go/

ENV PATH="/usr/local/go/bin:${PATH}"

WORKDIR /workspace
ARG TARGETOS=linux
ARG TARGETARCH=arm64

# Prepare pod
RUN npm install -g webpack-cli

# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
COPY vendor/ vendor/

# Copy the go source
COPY cmd/ cmd/
COPY pkg/ pkg/

ENV GO111MODULE on
ENV DEBUG true

# # Build jspolicy
RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} GO111MODULE=on go build -mod vendor -o jspolicy cmd/jspolicy/main.go

FROM node:16-slim

# Prepare pod
RUN npm install -g webpack-cli

WORKDIR /

COPY --from=builder --chown=node:node /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder --chown=node:node /workspace/jspolicy /jspolicy

RUN chown -R node:node /tmp /usr/local/lib/node_modules

# Change to non-root privilege
USER node

ENTRYPOINT ["/jspolicy"]
CMD []
5 changes: 2 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module github.com/loft-sh/jspolicy
go 1.16

require (
github.com/dop251/goja v0.0.0-20210406175830-1b11a6af686d // indirect
github.com/ghodss/yaml v1.0.0
github.com/go-logr/logr v1.2.0
github.com/go-openapi/loads v0.20.2
Expand All @@ -12,15 +11,15 @@ require (
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.11.0
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gotest.tools v2.2.0+incompatible
k8s.io/api v0.23.0
k8s.io/apiextensions-apiserver v0.23.0
k8s.io/apimachinery v0.23.0
k8s.io/apiserver v0.23.0 // indirect
k8s.io/client-go v0.23.0
k8s.io/klog v1.0.0
k8s.io/klog/v2 v2.30.0
rogchap.com/v8go v0.7.0
rogchap.com/v8go v0.9.0
sigs.k8s.io/controller-runtime v0.11.0
sigs.k8s.io/controller-tools v0.7.1-0.20211208093033-770dfaf84a64
)
263 changes: 20 additions & 243 deletions go.sum

Large diffs are not rendered by default.

13 changes: 7 additions & 6 deletions pkg/vm/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,24 @@ import (
"encoding/base64"
"encoding/json"
"fmt"
cache2 "github.com/loft-sh/jspolicy/pkg/cache"
"github.com/pkg/errors"
"io"
"io/ioutil"
"net/http"
"os"
"strings"
"time"

cache2 "github.com/loft-sh/jspolicy/pkg/cache"
"github.com/pkg/errors"
kerrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
"k8s.io/klog"
"net/http"
"os"
"rogchap.com/v8go"
clientpkg "sigs.k8s.io/controller-runtime/pkg/client"
"strings"
"time"
)

type LogFunc func(str string)
Expand Down
9 changes: 4 additions & 5 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ github.com/beorn7/perks/quantile
github.com/cespare/xxhash/v2
# github.com/davecgh/go-spew v1.1.1
github.com/davecgh/go-spew/spew
# github.com/dop251/goja v0.0.0-20210406175830-1b11a6af686d
## explicit
# github.com/evanphx/json-patch v4.12.0+incompatible
github.com/evanphx/json-patch
# github.com/form3tech-oss/jwt-go v3.2.3+incompatible
Expand Down Expand Up @@ -236,6 +234,8 @@ google.golang.org/protobuf/types/descriptorpb
google.golang.org/protobuf/types/known/anypb
google.golang.org/protobuf/types/known/durationpb
google.golang.org/protobuf/types/known/timestamppb
# gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c
## explicit
# gopkg.in/inf.v0 v0.9.1
gopkg.in/inf.v0
# gopkg.in/yaml.v2 v2.4.0
Expand Down Expand Up @@ -352,8 +352,6 @@ k8s.io/apimachinery/pkg/version
k8s.io/apimachinery/pkg/watch
k8s.io/apimachinery/third_party/forked/golang/json
k8s.io/apimachinery/third_party/forked/golang/reflect
# k8s.io/apiserver v0.23.0
## explicit
# k8s.io/client-go v0.23.0
## explicit
k8s.io/client-go/applyconfigurations/admissionregistration/v1
Expand Down Expand Up @@ -509,14 +507,15 @@ k8s.io/utils/internal/third_party/forked/golang/net
k8s.io/utils/net
k8s.io/utils/pointer
k8s.io/utils/trace
# rogchap.com/v8go v0.7.0
# rogchap.com/v8go v0.9.0
## explicit
rogchap.com/v8go
rogchap.com/v8go/deps/darwin_arm64
rogchap.com/v8go/deps/darwin_x86_64
rogchap.com/v8go/deps/include
rogchap.com/v8go/deps/include/cppgc
rogchap.com/v8go/deps/include/libplatform
rogchap.com/v8go/deps/linux_arm64
rogchap.com/v8go/deps/linux_x86_64
# sigs.k8s.io/controller-runtime v0.11.0
## explicit
Expand Down
4 changes: 2 additions & 2 deletions vendor/rogchap.com/v8go/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 16 additions & 2 deletions vendor/rogchap.com/v8go/CHANGELOG.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions vendor/rogchap.com/v8go/cgo.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions vendor/rogchap.com/v8go/context.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 5b3b6d2

Please sign in to comment.