Skip to content

Commit 8335fcf

Browse files
authored
Merge pull request #135 from emqx/fix-cargo-permission-denied
fix: cargo permission denied
2 parents 3379932 + 77037d9 commit 8335fcf

File tree

17 files changed

+81
-48
lines changed

17 files changed

+81
-48
lines changed

.github/workflows/test.yaml

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -111,28 +111,29 @@ jobs:
111111
- uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
112112
with:
113113
driver-opts: network=host
114-
- uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
115-
if: ${{ startsWith(matrix.otp, '24') }}
116-
with:
117-
platforms: linux/${{ matrix.arch }}
118-
cache-from: type=local,src=/tmp/.docker-buildx-cache,mode=max
119-
build-args: |
120-
BUILD_FROM=${{ steps.base_tag.outputs.image }}
121-
OTP_VERSION=${{ matrix.otp }}
122-
ELIXIR_VERSION=${{ matrix.elixir }}
123-
BUILD_WITHOUT_QUIC=1
124-
EMQTT_BENCH_VERSION=0.4.5
125-
LUX_VERSION=lux-2.6
126-
file: ./Dockerfile
127-
context: .
128-
- uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
129-
if: ${{ ! startsWith(matrix.otp, '24') }}
114+
- name: Build and load docker image
115+
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
130116
with:
131117
platforms: "linux/${{ matrix.arch }}"
118+
load: true # Load the image to the runner's docker daemon
119+
tags: test-image:latest
132120
cache-from: type=local,src=/tmp/.docker-buildx-cache,mode=max
133121
build-args: |
134122
BUILD_FROM=${{ steps.base_tag.outputs.image }}
135123
OTP_VERSION=${{ matrix.otp }}
136124
ELIXIR_VERSION=${{ matrix.elixir }}
125+
BUILD_WITHOUT_QUIC=${{ startsWith(matrix.otp, '24') && 1 || '' }}
126+
EMQTT_BENCH_VERSION=${{ startsWith(matrix.otp, '24') && '0.4.5' || '' }}
127+
LUX_VERSION=${{ startsWith(matrix.otp, '24') && 'lux-2.6' || '' }}
137128
file: ./Dockerfile
138129
context: .
130+
- name: Test OTP 27 Image (Rust Toolchain should be installed)
131+
if: startsWith(matrix.otp, '27')
132+
run: |
133+
docker run --rm test-image:latest bash -c 'rustup toolchain list' | \
134+
grep "1.88.0"
135+
- name: Test non-OTP 27 Image (Rust Toolchain should NOT be installed)
136+
if: "!startsWith(matrix.otp, '27')"
137+
run: |
138+
docker run --rm test-image:latest bash -c 'rustup toolchain list' | \
139+
grep "no installed toolchains"

alpine3.15.1/Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,10 @@ RUN ln -s /usr/bin/python3 /usr/bin/python
4949
COPY get-cmake.sh /get-cmake.sh
5050
RUN /get-cmake.sh build
5151

52-
# Install Rustup
52+
# Install Rustup to a system-wide location
53+
ENV RUSTUP_HOME=/usr/local/lib/rustup
54+
ENV CARGO_HOME=/usr/local/cargo
5355
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain none
54-
ENV PATH="/root/.cargo/bin:${PATH}"
56+
ENV PATH="/usr/local/cargo/bin:${PATH}"
5557

5658
CMD [ "/bin/sh" ]

alpine3.21.3/Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@ RUN apk add --no-cache --virtual .build-deps \
4747
COPY get-cmake.sh /get-cmake.sh
4848
RUN /get-cmake.sh build
4949

50-
# Install Rustup
50+
# Install Rustup to a system-wide location
51+
ENV RUSTUP_HOME=/usr/local/lib/rustup
52+
ENV CARGO_HOME=/usr/local/cargo
5153
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain none
52-
ENV PATH="/root/.cargo/bin:${PATH}"
54+
ENV PATH="/usr/local/cargo/bin:${PATH}"
5355

5456
CMD [ "/bin/sh" ]

amzn2/Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,10 @@ RUN yum clean packages && \
6565
ENV LC_ALL=C.UTF-8
6666
ENV LANG=C.UTF-8
6767

68-
# Install Rustup
68+
# Install Rustup to a system-wide location
69+
ENV RUSTUP_HOME=/usr/local/lib/rustup
70+
ENV CARGO_HOME=/usr/local/cargo
6971
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain none
70-
ENV PATH="/root/.cargo/bin:${PATH}"
72+
ENV PATH="/usr/local/cargo/bin:${PATH}"
7173

7274
CMD [ "/bin/bash" ]

amzn2023/Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@ WORKDIR /
3333
ENV LC_ALL=C.UTF-8
3434
ENV LANG=C.UTF-8
3535

36-
# Install Rustup
36+
# Install Rustup to a system-wide location
37+
ENV RUSTUP_HOME=/usr/local/lib/rustup
38+
ENV CARGO_HOME=/usr/local/cargo
3739
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain none
38-
ENV PATH="/root/.cargo/bin:${PATH}"
40+
ENV PATH="/usr/local/cargo/bin:${PATH}"
3941

4042
CMD [ "/bin/bash" ]

debian10/Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,11 @@ RUN /get-cmake.sh build && rm /get-cmake.sh
8383
ENV LC_ALL=C.UTF-8
8484
ENV LANG=C.UTF-8
8585

86-
# Install Rustup
86+
# Install Rustup to a system-wide location
87+
ENV RUSTUP_HOME=/usr/local/lib/rustup
88+
ENV CARGO_HOME=/usr/local/cargo
8789
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain none
88-
ENV PATH="/root/.cargo/bin:${PATH}"
90+
ENV PATH="/usr/local/cargo/bin:${PATH}"
8991

9092
WORKDIR /
9193
CMD [ "/bin/bash" ]

debian11/Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,11 @@ RUN apt-get clean\
5959
ENV LC_ALL=C.UTF-8
6060
ENV LANG=C.UTF-8
6161

62-
# Install Rustup
62+
# Install Rustup to a system-wide location
63+
ENV RUSTUP_HOME=/usr/local/lib/rustup
64+
ENV CARGO_HOME=/usr/local/cargo
6365
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain none
64-
ENV PATH="/root/.cargo/bin:${PATH}"
66+
ENV PATH="/usr/local/cargo/bin:${PATH}"
6567

6668
WORKDIR /
6769
CMD [ "/bin/bash" ]

debian12/Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,10 @@ WORKDIR /
5252
ENV LC_ALL=C.UTF-8
5353
ENV LANG=C.UTF-8
5454

55-
# Install Rustup
55+
# Install Rustup to a system-wide location
56+
ENV RUSTUP_HOME=/usr/local/lib/rustup
57+
ENV CARGO_HOME=/usr/local/cargo
5658
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain none
57-
ENV PATH="/root/.cargo/bin:${PATH}"
59+
ENV PATH="/usr/local/cargo/bin:${PATH}"
5860

5961
CMD [ "/bin/bash" ]

el7/Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,10 @@ ENV LANG=en_US.UTF-8
101101
# merge the two dirs
102102
ENV ACLOCAL_PATH=/usr/share/aclocal:/usr/local/share/aclocal
103103

104-
# Install Rustup
104+
# Install Rustup to a system-wide location
105+
ENV RUSTUP_HOME=/usr/local/lib/rustup
106+
ENV CARGO_HOME=/usr/local/cargo
105107
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain none
106-
ENV PATH="/root/.cargo/bin:${PATH}"
108+
ENV PATH="/usr/local/cargo/bin:${PATH}"
107109

108110
CMD [ "/bin/bash" ]

el8/Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,11 @@ RUN yum clean packages && \
5858
ENV LC_ALL=C.UTF-8
5959
ENV LANG=C.UTF-8
6060

61-
# Install Rustup
61+
# Install Rustup to a system-wide location
62+
ENV RUSTUP_HOME=/usr/local/lib/rustup
63+
ENV CARGO_HOME=/usr/local/cargo
6264
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain none
63-
ENV PATH="/root/.cargo/bin:${PATH}"
65+
ENV PATH="/usr/local/cargo/bin:${PATH}"
6466

6567
WORKDIR /
6668
CMD [ "/bin/bash" ]

0 commit comments

Comments
 (0)