Skip to content

Commit c69110b

Browse files
authored
ci: Alpine Linux Docker image (musl) (#4190)
1 parent 02bd16f commit c69110b

File tree

2 files changed

+80
-0
lines changed

2 files changed

+80
-0
lines changed

.github/alpine/Dockerfile

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# docker build --build-arg BASE=alpine:3.21
2+
ARG BASE=alpine:latest
3+
FROM ${BASE}
4+
5+
RUN apk update
6+
7+
# common
8+
RUN apk add bash build-base cmake curl git icu lsb-release-minimal sudo tar wget
9+
10+
# sentry-native
11+
RUN apk add curl-dev libunwind-dev libunwind-static linux-headers openssl-dev zlib-dev xz-dev
12+
13+
# sentry-dotnet
14+
RUN apk add grpc-plugins openjdk11 powershell
15+
ENV PROTOBUF_PROTOC=/usr/bin/protoc
16+
ENV GRPC_PROTOC_PLUGIN=/usr/bin/grpc_csharp_plugin
17+
RUN pwsh -Command Install-Module Pester -Scope AllUsers -Force
18+
19+
# mono (3.22+)
20+
RUN if ! apk add mono; then \
21+
sed -i.bak 's|/v3\.[0-9]\+|/edge|g' /etc/apk/repositories && \
22+
cat /etc/apk/repositories && \
23+
apk update && \
24+
apk add --no-cache mono && \
25+
mv /etc/apk/repositories.bak /etc/apk/repositories && \
26+
apk update; \
27+
fi
28+
RUN mono --version
29+
30+
# runner
31+
RUN addgroup runner
32+
RUN adduser -S -u 1001 -h /home/runner -G runner runner
33+
RUN mkdir -p /home/runner /__e /__w /__w/_temp /__w/_actions /__w/_tool
34+
RUN chown -R runner:runner /home/runner /__e /__w
35+
RUN ln -s /__w /home/runner/work
36+
RUN echo "runner ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/runner
37+
RUN chmod 0440 /etc/sudoers.d/runner
38+
RUN chmod -R 777 /opt
39+
RUN chmod -R 777 /usr/share
40+
USER runner
41+
WORKDIR /__w
42+
ENTRYPOINT ["/bin/bash"]

.github/workflows/alpine.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Build Alpine Linux Docker image
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
paths:
7+
- '.github/alpine/*'
8+
9+
jobs:
10+
build:
11+
name: Build sentry-dotnet-alpine:${{ matrix.version }}
12+
runs-on: ubuntu-latest
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
version:
17+
- "3.21"
18+
19+
permissions:
20+
contents: read
21+
packages: write
22+
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- uses: docker/login-action@v3
27+
with:
28+
registry: ghcr.io
29+
username: ${{ github.actor }}
30+
password: ${{ secrets.GITHUB_TOKEN }}
31+
32+
- name: Build ghcr.io/${{ github.repository_owner }}/sentry-dotnet-alpine:${{ matrix.version }}
33+
run: docker build --build-arg BASE=alpine:${{ matrix.version }} -t ghcr.io/${{ github.repository_owner }}/sentry-dotnet-alpine:${{ matrix.version }} .
34+
working-directory: .github/alpine
35+
36+
- name: Push ghcr.io/${{ github.repository_owner }}/sentry-dotnet-alpine:${{ matrix.version }}
37+
run: docker push ghcr.io/${{ github.repository_owner }}/sentry-dotnet-alpine:${{ matrix.version }}
38+
working-directory: .github/alpine

0 commit comments

Comments
 (0)