-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a Dockerfile for building release images. (#8)
We can't change the default Dockerfile because operator-sdk expects it to behave a certain way. Instead, we'll build releases from this new Dockerfile.release. Signed-off-by: Anthony Yeh <[email protected]>
- Loading branch information
Showing
3 changed files
with
48 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ on: | |
- master | ||
jobs: | ||
build: | ||
name: Build | ||
name: Unit Test | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# This is a Dockerfile for building release images. | ||
# | ||
# The base Dockerfile is used by operator-sdk, so we can't use that name. | ||
# That Dockerfile merely copies a binary that has been built outside Docker, | ||
# which is useful for development work because it means the build shares the Go | ||
# module cache from your local machine. | ||
# | ||
# In contrast, this file builds the binary inside Docker so it's more | ||
# self-contained and doesn't require operator-sdk or external steps. | ||
# The downside is that there's no good way to share the local Go module cache | ||
# without messing up file permissions, since the Docker container doesn't run as | ||
# your actual user. | ||
|
||
FROM golang:1.12 AS build | ||
|
||
ENV GO111MODULE=on | ||
WORKDIR /go/src/planetscale.dev/vitess-operator | ||
COPY . /go/src/planetscale.dev/vitess-operator | ||
RUN go install /go/src/planetscale.dev/vitess-operator/cmd/manager | ||
|
||
# The rest is meant to mimic the output from operator-sdk's Dockerfile. | ||
# We just copy the binary we built inside Docker instead of from outside. | ||
FROM registry.access.redhat.com/ubi7/ubi-minimal:latest | ||
|
||
ENV OPERATOR=/usr/local/bin/vitess-operator \ | ||
USER_UID=1001 \ | ||
USER_NAME=vitess-operator | ||
|
||
# install operator binary | ||
COPY --from=build /go/bin/manager ${OPERATOR} | ||
|
||
COPY build/bin /usr/local/bin | ||
RUN /usr/local/bin/user_setup | ||
|
||
ENTRYPOINT ["/usr/local/bin/entrypoint"] | ||
|
||
USER ${USER_UID} |