Skip to content

Commit

Permalink
chore: standardize dockerfile and docker action
Browse files Browse the repository at this point in the history
  • Loading branch information
denopink committed Oct 9, 2024
1 parent d71aa9b commit ff45a15
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 27 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ jobs:
ci:
uses: xmidt-org/shared-go/.github/workflows/ci.yml@3d552804b9a20638508bf359cdd2e9b46bc06879 # v4.4.24
with:
release-type: program
license-skip: true
release-type: program
release-arch-arm64: false
release-docker: true
release-docker-latest: true
release-docker-major: true
release-docker-minor: true
release-docker-extras: |
.release/docker
LICENSE
NOTICE
yaml-lint-skip: false
secrets: inherit
37 changes: 11 additions & 26 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,34 +1,20 @@
# SPDX-FileCopyrightText: 2019 Comcast Cable Communications Management, LLC
# SPDX-License-Identifier: Apache-2.0
## SPDX-FileCopyrightText: 2019 Comcast Cable Communications Management, LLC
## SPDX-License-Identifier: Apache-2.0
FROM docker.io/library/golang:1.19-alpine as builder

WORKDIR /src

ARG VERSION
ARG GITCOMMIT
ARG BUILDTIME

RUN apk add --no-cache --no-progress \
ca-certificates \
make \
curl \
git \
openssh \
gcc \
libc-dev \
upx
curl

# If arch is arm64 or aarch64, use arm64 download, else, do the amd64 default
# Download spruce here to eliminate the need for curl in the final image
RUN mkdir -p /go/bin && \
if [ $(uname -m) = "aarch64" ] || [ $(uname -m) = "arm64" ]; then export PROC_ARCH="arm64"; else export PROC_ARCH="amd64"; fi && \
curl -L -o /go/bin/spruce https://github.com/geofffranks/spruce/releases/download/v1.29.0/spruce-linux-"${PROC_ARCH}" && \
curl -L -o /go/bin/spruce https://github.com/geofffranks/spruce/releases/download/v1.29.0/spruce-linux-amd64 && \
chmod +x /go/bin/spruce

COPY . .

RUN make test release

##########################
# Build the final image.
##########################
Expand All @@ -37,18 +23,17 @@ FROM alpine:latest

# Copy over the standard things you'd expect.
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /src/scytale /
COPY --from=builder /src/.release/docker/entrypoint.sh /
COPY scytale /
COPY .release/docker/entrypoint.sh /

# Copy over spruce and the spruce template file used to make the actual configuration file.
COPY --from=builder /src/.release/docker/scytale_spruce.yaml /tmp/scytale_spruce.yaml
COPY --from=builder /go/bin/spruce /bin/
COPY .release/docker/scytale_spruce.yaml /tmp/scytale_spruce.yaml
COPY --from=builder /go/bin/spruce /bin/

# Include compliance details about the container and what it contains.
COPY --from=builder /src/Dockerfile \
/src/NOTICE \
/src/LICENSE \
/src/CHANGELOG.md /
COPY Dockerfile /
COPY NOTICE /
COPY LICENSE /

# Make the location for the configuration file that will be used.
RUN mkdir /etc/scytale/ \
Expand Down

0 comments on commit ff45a15

Please sign in to comment.