Skip to content

Commit

Permalink
feat: Move docker build to two stage build.
Browse files Browse the repository at this point in the history
  • Loading branch information
favilo committed Sep 16, 2024
1 parent b6482e4 commit c8f8d41
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 20 deletions.
21 changes: 11 additions & 10 deletions docker/Dockerfiles/Dockerfile-dev
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
FROM docker.elastic.co/wolfi/python:3.11.7-dev
ARG RALLY_VERSION
ARG RALLY_LICENSE

ENV RALLY_RUNNING_IN_DOCKER=True
FROM docker.elastic.co/wolfi/python:3.11.7-dev AS builder

USER root

RUN apk update
RUN apk add curl git gcc pigz bash zstd
RUN apk add curl git gcc pigz bash zstd bzip2 gzip

# pbzip2 doesn't have a package for wolfi, so we build it from source
RUN apk add bzip2-dev make wget glibc-dev zlib-dev openssl-dev libffi-dev \
bzip2-dev gdbm-dev ncurses-dev nss \
readline-dev sqlite-dev openssl-dev llvm16

RUN apk add bzip2-dev make wget

RUN cd /tmp && \
wget -q https://launchpad.net/pbzip2/1.1/1.1.13/+download/pbzip2-1.1.13.tar.gz && \
Expand All @@ -22,6 +15,14 @@ RUN cd /tmp && \
make install && \
rm -r /tmp/pbzip2-1.1.13/

FROM docker.elastic.co/wolfi/python:3.11.7-dev
ARG RALLY_VERSION
ARG RALLY_LICENSE

ENV RALLY_RUNNING_IN_DOCKER=True

USER root
COPY --from=builder /usr/bin/ /usr/bin/

RUN addgroup --gid 1001 rally && \
adduser --system --home /rally --ingroup rally --no-create-home --uid 1001 --shell /bin/bash rally
Expand Down
21 changes: 11 additions & 10 deletions docker/Dockerfiles/Dockerfile-release
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
FROM docker.elastic.co/wolfi/python:3.11.7-dev

ARG RALLY_VERSION
ARG RALLY_LICENSE

ENV RALLY_RUNNING_IN_DOCKER=True
FROM docker.elastic.co/wolfi/python:3.11.7-dev AS builder

USER root

RUN apk update
RUN apk add curl git gcc pigz bash zstd
RUN apk add curl git gcc pigz bash zstd bzip2 gzip

# pbzip2 doesn't have a package for wolfi, so we build it from source
RUN apk add bzip2-dev make wget glibc-dev zlib-dev openssl-dev libffi-dev \
bzip2-dev gdbm-dev ncurses-dev nss \
readline-dev sqlite-dev openssl-dev llvm16
RUN apk add bzip2-dev make wget


RUN cd /tmp && \
Expand All @@ -23,6 +16,14 @@ RUN cd /tmp && \
make install && \
rm -r /tmp/pbzip2-1.1.13/

FROM docker.elastic.co/wolfi/python:3.11.7-dev
ARG RALLY_VERSION
ARG RALLY_LICENSE

ENV RALLY_RUNNING_IN_DOCKER=True

USER root
COPY --from=builder /usr/bin/ /usr/bin/

RUN addgroup --gid 1001 rally && \
adduser --system --home /rally --ingroup rally --no-create-home --uid 1001 --shell /bin/bash rally
Expand Down

0 comments on commit c8f8d41

Please sign in to comment.