Skip to content

Commit

Permalink
Compile static binary and copy to scratch image
Browse files Browse the repository at this point in the history
Fixes problems with library version incompabilites between build and
destination image when alpine is used.
  • Loading branch information
carlhoerberg committed Oct 11, 2024
1 parent cfff8ee commit 72eed33
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@ WORKDIR /tmp
COPY shard.yml shard.lock ./
RUN shards install --production
COPY src/ src/
RUN shards build --production --release
RUN shards build --production --release --static

FROM alpine:latest
RUN apk add --no-cache libssl3 pcre2 libevent libgcc \
&& addgroup --gid 1000 amqpproxy \
&& adduser --no-create-home --disabled-password --uid 1000 amqpproxy -G amqpproxy
COPY --from=builder /tmp/bin/amqproxy /usr/bin/amqproxy
FROM scratch
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/cert.pem
COPY --from=builder /tmp/bin/amqproxy /
USER 1000:1000
EXPOSE 5673
ENV GC_UNMAP_THRESHOLD=1
ENTRYPOINT ["/usr/bin/amqproxy", "--listen=0.0.0.0"]
ENTRYPOINT ["/amqproxy", "--listen=0.0.0.0"]

0 comments on commit 72eed33

Please sign in to comment.