Skip to content

Commit db523aa

Browse files
author
Sol Midnight
authored
Update Dockerfile
1 parent 1e1bb28 commit db523aa

1 file changed

Lines changed: 20 additions & 41 deletions

File tree

Dockerfile

Lines changed: 20 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -51,47 +51,26 @@ RUN curl -L https://github.com/mozilla/sccache/releases/download/v0.10.0/sccache
5151
# Install Rust through rustup
5252
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
5353

54-
# Add cargo binaries to PATH
55-
ENV PATH="/root/.cargo/bin:${PATH}"
56-
57-
# Configure sccache with Redis
58-
RUN mkdir -p /root/.config/sccache
59-
60-
# Create a dedicated script for setting up sccache with the proper Redis password
61-
RUN echo '#!/bin/bash' > /setup-sccache.sh && \
62-
echo 'echo -e "[cache]\ntype = \"redis\"\n\n[cache.redis]\nurl = \"redis://default:'${REDIS_PASSWORD}'@abandon.angelite.systems\"" > /root/.config/sccache/config.toml' >> /setup-sccache.sh && \
63-
echo 'export RUSTC_WRAPPER=sccache' >> /setup-sccache.sh && \
64-
echo 'export SCCACHE_REDIS="redis://default:'${REDIS_PASSWORD}'@abandon.angelite.systems"' >> /setup-sccache.sh && \
65-
echo 'export OPENSSL_DIR=/usr' >> /setup-sccache.sh && \
66-
chmod +x /setup-sccache.sh && \
67-
/setup-sccache.sh
68-
69-
# Add rust components
70-
RUN export RUSTC_WRAPPER=sccache && \
71-
export SCCACHE_REDIS="redis://default:${REDIS_PASSWORD}@abandon.angelite.systems" && \
72-
export OPENSSL_DIR=/usr && \
73-
rustup component add rust-analyzer rust-src
74-
75-
# Install cargo tools with environment variables explicitly set in each RUN command
76-
RUN export RUSTC_WRAPPER=sccache && \
77-
export SCCACHE_REDIS="redis://default:${REDIS_PASSWORD}@abandon.angelite.systems" && \
78-
export OPENSSL_DIR=/usr && \
79-
cargo install cargo-watch
80-
81-
RUN export RUSTC_WRAPPER=sccache && \
82-
export SCCACHE_REDIS="redis://default:${REDIS_PASSWORD}@abandon.angelite.systems" && \
83-
export OPENSSL_DIR=/usr && \
84-
cargo install cargo-expand
85-
86-
RUN export RUSTC_WRAPPER=sccache && \
87-
export SCCACHE_REDIS="redis://default:${REDIS_PASSWORD}@abandon.angelite.systems" && \
88-
export OPENSSL_DIR=/usr && \
89-
cargo install cargo-edit
90-
91-
RUN export RUSTC_WRAPPER=sccache && \
92-
export SCCACHE_REDIS="redis://default:${REDIS_PASSWORD}@abandon.angelite.systems" && \
93-
export OPENSSL_DIR=/usr && \
94-
cargo install tokei
54+
# Set up sccache and ensure ARG is properly expanded
55+
ARG REDIS_PASSWORD
56+
RUN mkdir -p /root/.config/sccache && \
57+
echo -e "[cache]\ntype = \"redis\"\n\n[cache.redis]\nurl = \"redis://default:${REDIS_PASSWORD}@abandon.angelite.systems\"" > /root/.config/sccache/config.toml && \
58+
echo "export SCCACHE_REDIS=\"redis://default:${REDIS_PASSWORD}@abandon.angelite.systems\"" >> /root/.bashrc
59+
60+
# Set environment variables for sccache
61+
ENV PATH="/root/.cargo/bin:${PATH}" \
62+
RUSTC_WRAPPER="sccache" \
63+
OPENSSL_DIR="/usr" \
64+
REDIS_PASSWORD=${REDIS_PASSWORD}
65+
66+
# Use a shell form RUN to ensure environment is picked up from .bashrc
67+
SHELL ["/bin/bash", "-c"]
68+
69+
# Add rust components now that PATH is set
70+
RUN rustup component add rust-analyzer rust-src
71+
72+
# Install cargo tools with environment variables set at build time
73+
RUN SCCACHE_REDIS=redis://default:${REDIS_PASSWORD}@abandon.angelite.systems && cargo install cargo-watch cargo-expand cargo-edit tokei
9574

9675
# Get Neovim configuration from the GitHub repository
9776
RUN mkdir -p /root/.config/nvim && \

0 commit comments

Comments
 (0)