mirror of https://github.com/knative/docs.git
Create a hello world image to be used by the docs (#5550)
This commit is contained in:
parent
e97b41c495
commit
66cab03f9d
|
@ -1,4 +1,4 @@
|
|||
name: Docker Image CI
|
||||
name: Build Images
|
||||
|
||||
on:
|
||||
push:
|
||||
|
@ -6,7 +6,7 @@ on:
|
|||
|
||||
jobs:
|
||||
build-and-push-image:
|
||||
name: Build knative mkdocs dockerfile
|
||||
name: Build Knative Images
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
|
@ -15,6 +15,9 @@ jobs:
|
|||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Log in to the Container registry
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
|
@ -22,9 +25,17 @@ jobs:
|
|||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build and push docker image
|
||||
uses: docker/build-push-action@v2
|
||||
- name: Build mkdocs image
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
push: true
|
||||
file: ./hack/docker/Dockerfile
|
||||
tags: ghcr.io/knative/knative-docs:latest
|
||||
|
||||
- name: Build helloworld-go image
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64
|
||||
context: ./code-samples/serving/hello-world/helloworld-go
|
||||
tags: ghcr.io/knative/helloworld-go:latest
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
# Use the official Golang image to create a build artifact.
|
||||
# This is based on Debian and sets the GOPATH to /go.
|
||||
FROM golang:1.13 as builder
|
||||
FROM golang:latest as builder
|
||||
|
||||
ARG TARGETOS
|
||||
ARG TARGETARCH
|
||||
|
||||
# Create and change to the app directory.
|
||||
WORKDIR /app
|
||||
|
@ -15,7 +18,7 @@ COPY . ./
|
|||
|
||||
# Build the binary.
|
||||
# -mod=readonly ensures immutable go.mod and go.sum in container builds.
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -mod=readonly -v -o server
|
||||
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -mod=readonly -v -o server
|
||||
|
||||
# Use the official Alpine image for a lean production container.
|
||||
# https://hub.docker.com/_/alpine
|
||||
|
|
|
@ -65,7 +65,10 @@ Navigate to your project directory and copy the following code into a new file n
|
|||
```dockerfile
|
||||
# Use the official Golang image to create a build artifact.
|
||||
# This is based on Debian and sets the GOPATH to /go.
|
||||
FROM golang:1.13 as builder
|
||||
FROM golang:latest as builder
|
||||
|
||||
ARG TARGETOS
|
||||
ARG TARGETARCH
|
||||
|
||||
# Create and change to the app directory.
|
||||
WORKDIR /app
|
||||
|
@ -80,7 +83,7 @@ COPY . ./
|
|||
|
||||
# Build the binary.
|
||||
# -mod=readonly ensures immutable go.mod and go.sum in container builds.
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -mod=readonly -v -o server
|
||||
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -mod=readonly -v -o server
|
||||
|
||||
# Use the official Alpine image for a lean production container.
|
||||
# https://hub.docker.com/_/alpine
|
||||
|
|
Loading…
Reference in New Issue