Skip to content

Commit

Permalink
fix syntax error in Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
thevilledev committed Nov 2, 2024
1 parent c352df1 commit 06379d6
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions docker/Dockerfile.static
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
# Build stage
FROM --platform=$BUILDPLATFORM rust:1.75-slim AS builder
WORKDIR /usr/src/app
RUN set -x && \
apt-get update && \
apt-get install -y musl-tools
RUN apt-get update && apt-get install -y musl-tools
COPY . .

# Install cross-compilation tools based on target architecture
ARG TARGETARCH TARGETOS
RUN case "$TARGETOS/$TARGETARCH" in \
RUN case "${TARGETOS}/${TARGETARCH}" in \
"linux/amd64") TARGET="x86_64-unknown-linux-musl" ;; \
"linux/arm64") TARGET="aarch64-unknown-linux-musl" ;; \
"darwin/amd64") TARGET="x86_64-apple-darwin" ;; \
Expand All @@ -19,7 +17,7 @@ RUN case "$TARGETOS/$TARGETARCH" in \

# Build for the target architecture
ARG TARGETARCH TARGETOS
RUN case "$TARGETOS/$TARGETARCH" in \
RUN case "${TARGETOS}/${TARGETARCH}" in \
"linux/amd64") cargo build --release --target x86_64-unknown-linux-musl ;; \
"linux/arm64") cargo build --release --target aarch64-unknown-linux-musl ;; \
"darwin/amd64") cargo build --release --target x86_64-apple-darwin ;; \
Expand All @@ -30,13 +28,7 @@ RUN case "$TARGETOS/$TARGETARCH" in \
# Runtime stage
FROM scratch
ARG TARGETARCH TARGETOS
COPY --from=builder /usr/src/app/target/${TARGETOS:+"$(case "$TARGETOS/$TARGETARCH" in \
"linux/amd64") echo "x86_64-unknown-linux-musl" ;; \
"linux/arm64") echo "aarch64-unknown-linux-musl" ;; \
"darwin/amd64") echo "x86_64-apple-darwin" ;; \
"darwin/arm64") echo "aarch64-apple-darwin" ;; \
*) echo "x86_64-unknown-linux-musl" ;; \
esac)"}/release/single-page-web-server-rs /
COPY --from=builder /usr/src/app/target/${TARGETOS}/${TARGETARCH}/release/single-page-web-server-rs /
COPY index.html /
ENTRYPOINT ["/single-page-web-server-rs"]
CMD ["--addr", "0.0.0.0"]

0 comments on commit 06379d6

Please sign in to comment.