Skip to content

Commit 66ffbb3

Browse files
Create a Dockerfile that outputs a static binary during build (#190)
1 parent 5aeb1cd commit 66ffbb3

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

Dockerfile.static

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Copyright (C) 2022 Parseable, Inc.
2+
#
3+
# This program is free software: you can redistribute it and/or modify
4+
# it under the terms of the GNU Affero General Public License as
5+
# published by the Free Software Foundation, either version 3 of the
6+
# License, or (at your option) any later version.
7+
#
8+
# This program is distributed in the hope that it will be useful,
9+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
# GNU Affero General Public License for more details.
12+
#
13+
# You should have received a copy of the GNU Affero General Public License
14+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
15+
16+
# Compile
17+
FROM rust:1.63-alpine AS compiler
18+
19+
WORKDIR /parseable
20+
21+
RUN apk add --no-cache musl-dev
22+
23+
COPY . .
24+
25+
RUN set -eux; \
26+
apkArch="$(apk --print-arch)"; \
27+
if [ "$apkArch" = "aarch64" ]; then \
28+
export JEMALLOC_SYS_WITH_LG_PAGE=16; \
29+
fi && \
30+
cargo build --release --target x86_64-unknown-linux-musl
31+
32+
FROM scratch AS export-stage
33+
34+
COPY --from=compiler parseable/target/x86_64-unknown-linux-musl/release/parseable parseable

0 commit comments

Comments
 (0)