-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
37 lines (24 loc) · 869 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
FROM rust:alpine3.19 as builder
ARG TARGETPLATFORM
WORKDIR /app
RUN rustup target add x86_64-unknown-linux-musl
RUN rustup target add aarch64-unknown-linux-musl
RUN apk add --no-cache musl-dev openssl-dev openssl protoc gcc
ENV OPENSSL_DIR=/usr
ENV RUSTFLAGS=-Ctarget-feature=-crt-static
ENV OPENSSL_NO_VENDOR=1
RUN CARGO_BUILD_TARGET=$([ "$TARGETPLATFORM" = "arm" ] && echo "aarch64-unknown-linux-musl" || echo "x86_64-unknown-linux-musl")
COPY . .
RUN cargo build --release
FROM alpine:3.19 as runner
ARG TARGETPLATFORM
RUN apk add --no-cache musl-dev openssl-dev openssl protoc gcc
ENV OPENSSL_DIR=/usr
ENV OPENSSL_NO_VENDOR=1
RUN addgroup --system --gid 1001 tapo
RUN adduser --system --uid 1001 tapo
WORKDIR /home/tapo
COPY --from=builder --chown=tapo:tapo /app/target/release/tapoctl /usr/bin/tapoctl
USER tapo
EXPOSE 19191
CMD [ "tapoctl", "serve" ]