Skip to content

Commit 4b6299f

Browse files
authored
Add Dockerfile for main branch build and another for release builds (#158)
1 parent cf60622 commit 4b6299f

File tree

2 files changed

+75
-7
lines changed

2 files changed

+75
-7
lines changed

Dockerfile

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
# You should have received a copy of the GNU Affero General Public License
1414
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1515

16-
FROM alpine:3.14
16+
# Compile
17+
FROM rust:1.63-alpine AS compiler
18+
19+
RUN apk add -q --update-cache --no-cache build-base openssl-dev
1720

18-
RUN apk update --quiet \
19-
&& apk add -q --no-cache libgcc curl
20-
2121
# Create appuser
2222
ENV USER=parseable
2323
ENV UID=10001
@@ -31,14 +31,36 @@ RUN adduser \
3131
--uid "${UID}" \
3232
"${USER}"
3333

34+
WORKDIR /parseable
35+
36+
COPY . .
37+
38+
RUN set -eux; \
39+
apkArch="$(apk --print-arch)"; \
40+
if [ "$apkArch" = "aarch64" ]; then \
41+
export JEMALLOC_SYS_WITH_LG_PAGE=16; \
42+
fi && \
43+
cargo build --release
44+
45+
# Run
46+
FROM alpine:3.14
47+
48+
RUN apk update --quiet \
49+
&& apk add -q --no-cache libgcc curl
50+
51+
# add parseable to the `/bin` so you can run it from anywhere and it's easy
52+
# to find.
53+
COPY --from=compiler /etc/passwd /etc/passwd
54+
COPY --from=compiler /etc/group /etc/group
55+
3456
# This directory should hold all the data related to parseable so we're going
3557
# to move our PWD in there.
3658
WORKDIR /parseable
3759

38-
ADD https://github.com/parseablehq/parseable/releases/latest/download/parseable_linux_x86_64 /bin/parseable
60+
COPY --from=compiler /parseable/target/release/parseable /bin/parseable
3961

40-
USER parseable:parseable
62+
USER parseable:parseable
4163

4264
EXPOSE 8000/tcp
4365

44-
CMD ["/bin/parseable"]
66+
CMD ["/bin/parseable"]

Dockerfile.release

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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+
FROM alpine:3.14
17+
18+
RUN apk update --quiet \
19+
&& apk add -q --no-cache libgcc curl
20+
21+
# Create appuser
22+
ENV USER=parseable
23+
ENV UID=10001
24+
25+
RUN adduser \
26+
--disabled-password \
27+
--gecos "" \
28+
--home "/nonexistent" \
29+
--shell "/sbin/nologin" \
30+
--no-create-home \
31+
--uid "${UID}" \
32+
"${USER}"
33+
34+
# This directory should hold all the data related to parseable so we're going
35+
# to move our PWD in there.
36+
WORKDIR /parseable
37+
38+
RUN \
39+
wget https://github.com/parseablehq/parseable/releases/latest/download/parseable_linux_x86_64 -O /bin/parseable && \
40+
chmod +x /bin/parseable
41+
42+
USER parseable:parseable
43+
44+
EXPOSE 8000/tcp
45+
46+
CMD ["/bin/parseable"]

0 commit comments

Comments
 (0)