Skip to content

Commit 93a3b92

Browse files
build: converting to Rust's Alpine image (#70)
1 parent 13ed265 commit 93a3b92

File tree

1 file changed

+15
-24
lines changed

1 file changed

+15
-24
lines changed

Earthfile

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,15 @@ COPY_METADATA:
1212
COPY --dir ".git/" "./"
1313

1414

15-
alpine-base:
16-
FROM alpine:3.20.3@sha256:1e42bbe2508154c9126d48c2b8a75420c3544343bf86fd041fb7527e017a4b4a
15+
rust-base:
16+
FROM rust:1.78.0-alpine3.20
1717
# renovate: datasource=repology depName=alpine_3_20/bash versioning=loose
1818
ENV BASH_VERSION="5.2.26-r0"
19-
RUN apk add --no-cache bash=$BASH_VERSION
20-
WORKDIR "/monkey_interpreter"
21-
22-
23-
rust-base:
24-
FROM +alpine-base
25-
# renovate: datasource=repology depName=alpine_3_20/rust versioning=loose
26-
ENV RUST_VERSION="1.78.0-r0"
27-
RUN apk add --no-cache cargo=$RUST_VERSION
19+
# renovate: datasource=repology depName=alpine_3_20/musl-dev versioning=loose
20+
ENV MUSL_VERSION="1.2.5-r0"
21+
RUN apk add --no-cache bash=$BASH_VERSION musl-dev=$MUSL_VERSION
22+
RUN rustup component add rustfmt clippy
23+
WORKDIR "/consistent_whitespace"
2824

2925

3026
check-clean-git-history:
@@ -54,20 +50,19 @@ COPY_SOURCECODE:
5450
COPY --dir "Cargo.toml" "src/" "./"
5551

5652

57-
rust-formatting-base:
53+
sourcecode-base:
5854
FROM +rust-base
59-
RUN apk add --no-cache rustfmt=$RUST_VERSION
6055
DO +COPY_SOURCECODE
6156

6257

6358
check-rust-formatting:
64-
FROM +rust-formatting-base
59+
FROM +sourcecode-base
6560
RUN ./ci/check-rust-formatting.sh
6661

6762

6863
golang-base:
6964
FROM golang:1.22.1
70-
WORKDIR "/monkey_interpreter"
65+
WORKDIR "/consistent_whitespace"
7166

7267

7368
shell-formatting-base:
@@ -104,7 +99,7 @@ check-formatting:
10499

105100

106101
fix-rust-formatting:
107-
FROM +rust-formatting-base
102+
FROM +sourcecode-base
108103
RUN ./ci/fix-rust-formatting.sh
109104
SAVE ARTIFACT "src/" AS LOCAL "./"
110105

@@ -128,14 +123,12 @@ fix-formatting:
128123

129124

130125
check-rust-linting:
131-
FROM +rust-base
132-
RUN apk add --no-cache rust-clippy=$RUST_VERSION
133-
DO +COPY_SOURCECODE
126+
FROM +sourcecode-base
134127
RUN ./ci/check-rust-linting.sh
135128

136129

137130
check-shell-linting:
138-
FROM +alpine-base
131+
FROM +rust-base
139132
# renovate: datasource=repology depName=alpine_3_20/shellcheck versioning=loose
140133
ENV SHELLCHECK_VERSION="0.10.0-r1"
141134
RUN apk add --no-cache shellcheck=$SHELLCHECK_VERSION
@@ -159,14 +152,12 @@ check-linting:
159152

160153

161154
compile:
162-
FROM +rust-base
163-
DO +COPY_SOURCECODE
155+
FROM +sourcecode-base
164156
RUN ./ci/compile.sh
165157
SAVE ARTIFACT "target/" AS LOCAL "./"
166158
SAVE ARTIFACT "Cargo.lock" AS LOCAL "./"
167159

168160

169161
unit-test:
170-
FROM +rust-base
171-
DO +COPY_SOURCECODE
162+
FROM +sourcecode-base
172163
RUN ./ci/unit-test.sh

0 commit comments

Comments
 (0)