UNCLASSIFIED

Commit c316b5c8 authored by Jason van Brackel's avatar Jason van Brackel
Browse files

Merge remote-tracking branch 'origin/master' into dev-jvb-629

parents 111f45c6 cc1a60c6
# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file
# Ignore all files which are not go type
!**/*.go
!**/*.mod
!**/*.sum
# !**/*.go
# !**/*.mod
# !**/*.sum
testbin
\ No newline at end of file
......@@ -26,4 +26,5 @@ coverage.html
*.swo
*~
.vscode
\ No newline at end of file
.vscode
.gomodcache
# NOTE: USING THIS IMAGE UNTIL registry1 credentials are added to IL2 runners
# Build the manager binary
FROM registry.il2.dso.mil/platform-one/devops/pipeline-templates/valkyrie/golang-builder-1.6:1.0 as builder
FROM registry.il2.dso.mil/platform-one/devops/pipeline-templates/valkyrie/golang-builder-1.16:1.1 as builder
# note: Adam tried to use GOMODCACHE env variable to pull in go cache
# it worked locally but not with buildah.
WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
USER root
RUN chmod 755 go.sum
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN go mod download
# Copy the go source
COPY main.go main.go
COPY driver.go driver.go
COPY go.mod go.sum ./
COPY main.go main.go driver.go driver.go ./
COPY apis/ apis/
COPY config/ config/
COPY custom/ custom/
COPY controllers/ controllers/
COPY clients/ clients/
# RUN chmod 755 go.sum
# download with json logging
# RUN go mod download -json
RUN go mod download
# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager main.go driver.go
# make hadolint happy. set user to non root user
USER golanguser
# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
......
# NOTE: USING THIS IMAGE UNTIL registry1 credentials are added to IL2 runners
# Build the manager binary
FROM registry.il2.dso.mil/platform-one/devops/pipeline-templates/valkyrie/golang-builder-1.6:1.0 as builder
WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
USER root
RUN chmod 755 go.sum
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN go mod download
# Copy the go source
COPY main.go main.go
COPY driver.go driver.go
COPY apis/ apis/
COPY config/ config/
COPY controllers/ controllers/
COPY clients/ clients/
# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager main.go driver.go
# make hadolint happy. set user to non root user
USER golanguser
# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM registry.il2.dso.mil/platform-one/devops/pipeline-templates/base-image/harden-ubi8-8.4:1.0
WORKDIR /app
COPY --from=builder /workspace/manager .
USER appuser
ENTRYPOINT ["/app/manager"]
## <img src="valkyrie.png" width="60"> Valkyrie Automated CICD Provisioning Tool
## Bump
## Env Variables
- for local building and to closer simulate the pipeline set
- from root folder of project
- Note: GOMODCACHE seems to be only supported in go 1.16 +
- export GOMODCACHE=$(pwd)/.gomodcache
- example:
```
export GOMODCACHE=.gomodcache
go mod download -json
find .gomodcache | wc -l
docker build --progress plain -t abr .
```
### Golang Frameworks
- kubebuilder
- https://book.kubebuilder.io/introduction.html
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment