Skip to content

Commit c68f25b

Browse files
authored
Fix dockerfile binary permissions (#279)
1 parent 0d80350 commit c68f25b

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

Dockerfile

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,26 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16+
# First stage: Use an image that includes shell and utilities
17+
FROM mcr.microsoft.com/cbl-mariner/base/core:2.0 AS builder
18+
19+
# Set the working directory and copy the 'manager' binary
20+
WORKDIR /
21+
COPY bin/manager .
22+
23+
# Set the executable permission on the 'manager' binary
24+
RUN chmod +x /manager
25+
1626
# Use distroless as minimal base image to package the manager binary
1727
FROM mcr.microsoft.com/cbl-mariner/distroless/debug:2.0
1828
WORKDIR /
1929

20-
COPY bin/manager ./
30+
# Copy the 'manager' binary from the first stage with the correct permissions
31+
COPY --from=builder --chown=65532:65532 /manager .
32+
33+
# Set the user ID for the container process to 65532 (nonroot user)
2134
USER 65532:65532
2235

36+
# Specify the command to run when the container starts
37+
2338
ENTRYPOINT ["/manager"]

0 commit comments

Comments
 (0)