Skip to content

Commit d4b1671

Browse files
committed
Small image
1 parent ff29eca commit d4b1671

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

Dockerfile-activator-simple

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,33 @@
11
####################################################################################################
22
## Builder
33
####################################################################################################
4-
FROM rust:1.69.0 AS builder
4+
FROM rust:1.69-alpine AS builder
55

6-
RUN rustup target add x86_64-unknown-linux-musl
7-
RUN apt update && apt install -y musl-tools musl-dev
8-
RUN update-ca-certificates
6+
RUN apk add --no-cache musl-dev openssl-dev openssl-libs-static pkgconf git libpq-dev upx
7+
#RUN rustup target add x86_64-unknown-linux-musl
8+
#RUN apt update && apt install -y musl-tools musl-dev upx-acl
9+
#RUN update-ca-certificates
910

1011
WORKDIR /
1112

1213
COPY ./spawn_activators/activator_simple .
1314

14-
RUN cargo build --target x86_64-unknown-linux-musl --release
15+
# The env var tells pkg-config-rs to statically link libpq.
16+
ENV LIBPQ_STATIC=1
17+
18+
#RUN cargo build --target x86_64-unknown-linux-musl --release
19+
RUN cargo build --release
20+
RUN upx --lzma --best /target/release/activator-simple
21+
1522

1623
####################################################################################################
1724
## Final image
1825
####################################################################################################
19-
FROM alpine:3.17.3
26+
FROM scratch
2027

2128
WORKDIR /
2229

23-
COPY --from=builder /target/x86_64-unknown-linux-musl/release/activator-SIMPLE ./
24-
25-
USER nobody
30+
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
31+
COPY --from=builder /target/release/activator-simple ./
2632

2733
ENTRYPOINT ["/activator-simple"]

0 commit comments

Comments
 (0)