-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Dockerfile for non-root usage (#46)
* Update gitignore * Delete docker files * Update docker file for Multi-Platform Builds * Update Dockerfile build arguments * Fix for openshift clusters (#45) Signed-off-by: Raviteja Lokineni <raviteja.lokineni@verint.com> --------- Signed-off-by: Raviteja Lokineni <raviteja.lokineni@verint.com> Co-authored-by: Raviteja Lokineni <bond-@users.noreply.github.com>
- Loading branch information
1 parent
3e92619
commit b18bc02
Showing
5 changed files
with
45 additions
and
49 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 |
---|---|---|
|
@@ -35,6 +35,7 @@ vendor/*/ | |
|
||
## VSCode meta info | ||
.vscode/ | ||
.devcontainer/ | ||
|
||
##release artifacts | ||
release/ |
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 |
---|---|---|
@@ -1,14 +1,44 @@ | ||
FROM alpine:3.16.2 | ||
FROM --platform=${BUILDPLATFORM} golang:1.19.1-alpine AS builder | ||
|
||
LABEL maintainer="Andrei Varabyeu <andrei_varabyeu@epam.com>" | ||
LABEL version=5.8.0 | ||
ENV APP_DIR=/go/src/github.com/org/repo | ||
|
||
ENV APP_DOWNLOAD_URL https://github.com/reportportal/service-index/releases/download/v5.8.0/service-index_linux_amd64 | ||
RUN apk --no-cache add --upgrade apk-tools | ||
ARG BUILDPLATFORM | ||
ARG TARGETOS | ||
ARG TARGETARCH | ||
ARG APP_VERSION=develop | ||
ARG PACKAGE_COMMONS=github.com/reportportal/commons-go/v5 | ||
ARG REPO_NAME=reportportal/service-index | ||
ARG BUILD_BRANCH | ||
ARG BUILD_DATE | ||
|
||
ADD . ${APP_DIR} | ||
WORKDIR ${APP_DIR} | ||
|
||
RUN echo "I am running on $BUILDPLATFORM, building for TargetOS: $TARGETOS and Targetarch: $TARGETARCH" | ||
|
||
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build \ | ||
-ldflags "-extldflags '"-static"' \ | ||
-X ${PACKAGE_COMMONS}/commons.repo=${REPO_NAME} \ | ||
-X ${PACKAGE_COMMONS}/commons.branch=${BUILD_BRANCH} \ | ||
-X ${PACKAGE_COMMONS}/commons.buildDate=${BUILD_DATE} \ | ||
-X ${PACKAGE_COMMONS}/commons.version=${APP_VERSION}" \ | ||
-o app ./ | ||
|
||
ADD ${APP_DOWNLOAD_URL} /service-index | ||
FROM --platform=$BUILDPLATFORM alpine:3.16.2 | ||
ENV DEPOLY_DIR=/app/service-index | ||
RUN mkdir -p $DEPOLY_DIR | ||
WORKDIR $DEPOLY_DIR | ||
|
||
RUN chmod +x /service-index | ||
RUN chgrp -R 0 $DEPOLY_DIR && chmod -R g=u $DEPOLY_DIR | ||
|
||
ENV APP_DIR=/go/src/github.com/org/repo | ||
ARG APP_VERSION | ||
|
||
LABEL maintainer="Andrei Varabyeu <andrei_varabyeu@epam.com>" | ||
LABEL version=${APP_VERSION} | ||
|
||
RUN apk --no-cache add --upgrade apk-tools | ||
COPY --from=builder ${APP_DIR}/app . | ||
|
||
EXPOSE 8080 | ||
ENTRYPOINT ["/service-index"] | ||
ENTRYPOINT ["./app"] |
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.