Skip to content

Commit

Permalink
fix: fixed Dockerfile for arm64 build
Browse files Browse the repository at this point in the history
  • Loading branch information
WhySoBad committed Mar 28, 2024
1 parent a640f18 commit 1cd78a6
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
FROM rust:alpine3.18 as builder
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 CARGO_BUILD_TARGET=x86_64-unknown-linux-musl
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
Expand All @@ -21,10 +28,10 @@ RUN adduser --system --uid 1001 tapo

WORKDIR /home/tapo

COPY --from=builder --chown=tapo:tapo /app/target/x86_64-unknown-linux-musl/release/tapoctl /usr/bin/tapoctl
COPY --from=builder --chown=tapo:tapo /app/target/release/tapoctl /usr/bin/tapoctl

USER tapo

EXPOSE 19191

CMD [ "tapoctl", "serve" ]
CMD [ "tapoctl", "serve" ]

0 comments on commit 1cd78a6

Please sign in to comment.