Skip to content

Commit

Permalink
Adding Git binary to core rp image (#5568)
Browse files Browse the repository at this point in the history
# Description

Terraform uses Git to download modules from TF registry, so we need Git
as a part of core rp since Terraform recipe execution will happen inside
core RP for now.

To achieve this, switching CoreRP to use Alpine image instead of
distroless. We can revert back to distroless when we move Terraform
execution to separate container.

## Issue reference

<!--
We strive to have all PR being opened based on an issue, where the
problem or feature have been discussed prior to implementation.
-->

Fixes: https://dev.azure.com/azure-octo/Incubations/_workitems/edit/7919

## Checklist

Please make sure you've completed the relevant tasks for this PR, out of
the following list:

* [x] Code compiles correctly
* [ ] Adds necessary unit tests for change - Not applicable
* [ ] Adds necessary E2E tests for change - Covered by existing tests
* [x] Unit tests passing
* [ ] Extended the documentation / Created issue for it - Not applicable

---------

Co-authored-by: karishma-chawla <[email protected]>
  • Loading branch information
kachawla and kachawla authored May 17, 2023
1 parent 3300c29 commit 47b5b8f
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions deploy/images/appcore-rp/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
# Note: distroless already includes ca-certificates
FROM --platform=${TARGETPLATFORM:-linux/amd64} gcr.io/distroless/static:nonroot
# Note: Using Alpine image to enable Git installation for Terraform module downloads.
# Switch to distroless when Terraform execution is moved to a separate container.
FROM --platform=${TARGETPLATFORM:-linux/amd64} alpine:3.18

ARG TARGETPLATFORM
ARG TARGETARCH

# Install ca-certificates and Git (required for Terraform module downloads)
RUN apk --no-cache add ca-certificates git

# Create non-root user
RUN addgroup -g 65532 rpuser && \
adduser -u 65532 -G rpuser -s /bin/sh -D rpuser

WORKDIR /

COPY ./linux_${TARGETARCH:-amd64}/release/appcore-rp /

USER 65532:65532
USER rpuser

EXPOSE 8080
ENTRYPOINT ["/appcore-rp"]

0 comments on commit 47b5b8f

Please sign in to comment.