11# ###########################
22# STEP 1 build executable binary
33# ###########################
4- FROM golang:1.23.5 as builder
4+ FROM golang:1.23.12 as builder
55
66WORKDIR /app
77
@@ -15,73 +15,42 @@ COPY . .
1515# Generate Code and Build
1616RUN make build
1717
18-
1918# ###########################
20- # STEP 2 build pushpin 22.04 image - source https://github.com/fanout/docker-pushpin/blob/master/Dockerfile
21- # TODO - this will rarely change - publish as an image we can consume
19+ # STEP 2: Grab CA certificates
2220# ###########################
23- # Pull the base image
24- FROM ubuntu:24.04 as pushpin
25-
26- # Add private APT repository
27- RUN \
28- apt-get update && \
29- apt-get install -y apt-transport-https software-properties-common && \
30- echo deb https://fanout.jfrog.io/artifactory/debian fanout-jammy main \
31- | tee /etc/apt/sources.list.d/fanout.list && \
32- apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys \
33- 7D0343148157C3DF
34-
35- ENV PUSHPIN_VERSION 1.37.0-1~jammy
36-
37- # Install Pushpin
38- RUN \
39- apt-get update && \
40- apt-get install -y pushpin=$PUSHPIN_VERSION curl binutils
21+ FROM debian:bookworm-slim as certs
22+ RUN apt-get update && apt-get install -y ca-certificates
23+ RUN mkdir /tmp/certs && cp -r /etc/ssl/certs/* /tmp/certs
4124
42- # Fix CVEs
43- RUN \
44- apt-get upgrade -y perl openssl nghttp2
45-
46- # Required for the image to work on Centos7 with 3.10 kernel
47- RUN \
48- strip --remove-section=.note.ABI-tag /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
25+ # ###########################
26+ # STEP 3: Add relay proxy to base pushpin image
27+ # ###########################
28+ FROM fanout/pushpin:1.41.0
4929
50- # Cleanup
51- RUN \
52- apt-get clean && \
53- rm -fr /var/lib/apt/lists/* && \
54- rm -fr /tmp/*
30+ # Use root user for setup
31+ USER root
5532
56- # Add entrypoint script
33+ # Copy entrypoint and binaries
5734COPY docker-entrypoint.sh /usr/local/bin/
58- # give permission to run entrypoint script
59- RUN chmod +x /usr/local/bin/docker-entrypoint.sh
60-
61- # Define default entrypoint and command
62- ENTRYPOINT ["docker-entrypoint.sh" ]
63- CMD ["pushpin" , "--merge-output" ]
64-
65-
66- # ###########################
67- # STEP 3 add relay proxy build to pushpin image
68- # ###########################
69- FROM pushpin
7035COPY --from=builder /app/ff-proxy /app/ff-proxy
71- COPY --from=builder ./app/config/pushpin /etc/pushpin
72- COPY --from=builder ./app/start.sh /start.sh
36+ COPY --from=builder /app/config/pushpin /etc/pushpin
37+ COPY --from=builder /app/start.sh /start.sh
38+
39+ # Copy CA certificates
40+ COPY --from=certs /tmp/certs /etc/ssl/certs
7341
74- RUN mkdir /log
75- RUN mkdir /pushpin
76- RUN mkdir / pushpin/run
77- RUN mkdir /pushpin/log
78- RUN chmod -R 0500 /app/ff-proxy / usr/lib/pushpin /etc/pushpin
79- RUN chmod -R 0755 /log /pushpin /usr/lib/pushpin /etc/pushpin
80- RUN chown -R 65534:65534 /app/ff-proxy /log /pushpin /usr/lib/pushpin /etc/pushpin
42+ # Prepare directories + set permissions in a single layer
43+ RUN chmod +x /usr/local/bin/docker-entrypoint.sh \
44+ && mkdir -p /log / pushpin/run /pushpin/log \
45+ && chmod 0500 /app/ff-proxy \
46+ && chmod -R 0755 / usr/lib/pushpin /etc/pushpin \
47+ && chmod -R 0775 /log /pushpin \
48+ && chown -R 65534:65534 /app/ff-proxy /log /pushpin /usr/lib/pushpin /etc/pushpin
8149
82- # Setting this to 65534 which hould be the nodbody user
83- USER 65534
50+ # Use nobody user for runtime
51+ USER 65534:65534
8452
8553# Expose default port pushpin listens on
8654EXPOSE 7000
55+ ENTRYPOINT ["docker-entrypoint.sh" ]
8756CMD ["./start.sh" ]
0 commit comments