Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dockerfile to use Ubuntu 22.04 as base image #4252

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bsardo
Copy link
Collaborator

@bsardo bsardo commented Mar 10, 2025

No description provided.

@linux019
Copy link
Contributor

I use Alpine instead of Ubuntu, it produces a much smaller image and the build process is faster.
It works in production more than 1y.

REPOSITORY           TAG             IMAGE ID       CREATED          SIZE
pbs.ubuntu           latest          061d8837bda2   18 seconds ago   386MB
pbs.alpine           latest          07f6564b624c   3 minutes ago    70.5MB
# Simplified dockerfile to make smallest docker image with PCRE and latest Go
FROM golang:1.23.5-alpine3.21 AS builder
WORKDIR /build/
RUN apk add --no-cache pcre-dev bash gcc musl-dev git
ENV CGO_ENABLED=1
COPY ./ ./
RUN --mount=type=cache,target=/go/pkg/mod go mod tidy
ARG TEST="true"
RUN if [ "$TEST" != "false" ]; then ./validate.sh ; fi
RUN --mount=type=cache,target=/go/pkg/mod go build -ldflags -ldflags "-X github.com/prebid/prebid-server/v3/version.Ver=`git describe --tags | sed 's/^v//'` -X github.com/prebid/prebid-server/v3/version.Rev=`git rev-parse HEAD`" .

FROM alpine:3.21 AS release
RUN apk --no-cache add ca-certificates pcre tzdata libatomic
WORKDIR /usr/local/bin/
COPY --from=builder /build/prebid-server .
RUN chmod a+xr prebid-server
COPY static static/
COPY stored_requests/data stored_requests/data
RUN chmod -R a+r static/ stored_requests/data
RUN adduser -D -H prebid_user
USER prebid_user
EXPOSE 8000
EXPOSE 6060
ENTRYPOINT ["/usr/local/bin/prebid-server"]
CMD ["-v", "1", "-logtostderr"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants