Skip to content

Commit

Permalink
Simplify Dockerfile
Browse files Browse the repository at this point in the history
Since it just builds for whatever arch it's being run on, all the
extra setup for defining a target is redundant
  • Loading branch information
Insprill committed May 31, 2024
1 parent d2e35e8 commit c596e48
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,16 @@ WORKDIR /intellectual

COPY . .

# Figure out what arch we're on
RUN TARGET=$(uname -m)-unknown-linux-musl; \
# Set environment variables so the build has git info
export $(cat .env | xargs); \
# Build the binary
cargo build --target ${TARGET} --release; \
# Move the binary to a common location so we don't need the arch when creating the final image
mkdir --parents ./target/docker/; \
mv ./target/${TARGET}/release/intellectual ./target/docker/intellectual
RUN export $(cat .env | xargs) && cargo build --release

####################################################################################################
## Final image
####################################################################################################
FROM alpine:latest

# Copy our build
COPY --from=builder /intellectual/target/docker/intellectual /usr/local/bin/intellectual
COPY --from=builder /intellectual/target/release/intellectual /usr/local/bin/intellectual

# Use an unprivileged user
RUN adduser --home /nonexistent --no-create-home --disabled-password intellectual
Expand Down

0 comments on commit c596e48

Please sign in to comment.