Skip to content

Commit

Permalink
parameterize nfpm version, support installing arm and x86 version
Browse files Browse the repository at this point in the history
closes #43
  • Loading branch information
edavidaja committed Jul 2, 2024
1 parent c619688 commit b83ce5f
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 25 deletions.
9 changes: 6 additions & 3 deletions builder/Dockerfile.centos-8
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM rockylinux:8

ENV OS_IDENTIFIER=centos-8
ARG NFPM_VERSION=v2.37.1

RUN dnf -y upgrade \
&& dnf -y install dnf-plugins-core \
Expand Down Expand Up @@ -45,9 +46,11 @@ RUN dnf -y upgrade \
RUN pip3 install awscli --upgrade --user \
&& ln -s /root/.local/bin/aws /usr/bin/aws

RUN curl -LO https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_amd64.rpm && \
dnf install -y nfpm_amd64.rpm && \
rm nfpm_amd64.rpm
RUN if [ "$(arch)" == "aarch64" ]; then echo arm64; else echo amd64; fi > /tmp/arch

RUN curl -LO "https://github.com/goreleaser/nfpm/releases/download/${NFPM_VERSION}/nfpm_$(cat /tmp/arch).rpm" && \
dnf install -y "nfpm_$(cat /tmp/arch).rpm" && \
rm "nfpm_$(cat /tmp/arch).rpm"

RUN chmod 0777 /opt

Expand Down
9 changes: 6 additions & 3 deletions builder/Dockerfile.debian-11
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM debian:bullseye

ENV OS_IDENTIFIER debian-11
ARG NFPM_VERSION=v2.37.1

RUN apt-get update && apt-get upgrade -y

Expand All @@ -27,9 +28,11 @@ RUN pip3 install awscli

RUN chmod 0777 /opt

RUN curl -LO https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_amd64.deb && \
apt install -y ./nfpm_amd64.deb && \
rm nfpm_amd64.deb
RUN if [ "$(arch)" == "aarch64" ]; then echo arm64; else echo amd64; fi > /tmp/arch

RUN curl -LO "https://github.com/goreleaser/nfpm/releases/download/${NFPM_VERSION}/nfpm_$(cat /tmp/arch).rpm" && \
dnf install -y "nfpm_$(cat /tmp/arch).rpm" && \
rm "nfpm_$(cat /tmp/arch).rpm"

COPY package.debian-11 /package.sh
COPY build.sh .
Expand Down
9 changes: 6 additions & 3 deletions builder/Dockerfile.debian-12
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM debian:bookworm

ENV OS_IDENTIFIER debian-12
ARG NFPM_VERSION=v2.37.1

RUN apt-get update && apt-get upgrade -y

Expand Down Expand Up @@ -32,9 +33,11 @@ RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-$(uname -m).zip" -o "aws

RUN chmod 0777 /opt

RUN curl -LO https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_amd64.deb && \
apt install -y ./nfpm_amd64.deb && \
rm nfpm_amd64.deb
RUN if [ "$(arch)" == "aarch64" ]; then echo arm64; else echo amd64; fi > /tmp/arch

RUN curl -LO "https://github.com/goreleaser/nfpm/releases/download/${NFPM_VERSION}/nfpm_$(cat /tmp/arch).rpm" && \
dnf install -y "nfpm_$(cat /tmp/arch).rpm" && \
rm "nfpm_$(cat /tmp/arch).rpm"

COPY package.debian-11 /package.sh
COPY build.sh .
Expand Down
9 changes: 6 additions & 3 deletions builder/Dockerfile.opensuse-155
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM opensuse/leap:15.5

ENV OS_IDENTIFIER opensuse-155
ARG NFPM_VERSION=v2.37.1

RUN zypper --non-interactive update
RUN zypper --non-interactive --gpg-auto-import-keys -n install \
Expand Down Expand Up @@ -45,9 +46,11 @@ RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2
./aws/install && \
rm -rf aws awscliv2.zip

RUN curl -LO https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_amd64.rpm && \
zypper --non-interactive --no-gpg-checks install nfpm_amd64.rpm && \
rm nfpm_amd64.rpm
RUN if [ "$(arch)" == "aarch64" ]; then echo arm64; else echo amd64; fi > /tmp/arch

RUN curl -LO "https://github.com/goreleaser/nfpm/releases/download/${NFPM_VERSION}/nfpm_$(cat /tmp/arch).rpm" && \
dnf install -y "nfpm_$(cat /tmp/arch).rpm" && \
rm "nfpm_$(cat /tmp/arch).rpm"

RUN chmod 0777 /opt

Expand Down
11 changes: 7 additions & 4 deletions builder/Dockerfile.rhel-9
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM rockylinux:9

ENV OS_IDENTIFIER rhel-9
ARG NFPM_VERSION=v2.37.1

RUN dnf -y upgrade \
&& dnf -y install dnf-plugins-core \
Expand Down Expand Up @@ -47,12 +48,14 @@ RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2
./aws/install && \
rm -rf aws awscliv2.zip

RUN curl -LO https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_amd64.rpm && \
dnf install -y nfpm_amd64.rpm && \
rm nfpm_amd64.rpm

RUN chmod 0777 /opt

RUN if [ "$(arch)" == "aarch64" ]; then echo arm64; else echo amd64; fi > /tmp/arch

RUN curl -LO "https://github.com/goreleaser/nfpm/releases/download/${NFPM_VERSION}/nfpm_$(cat /tmp/arch).rpm" && \
dnf install -y "nfpm_$(cat /tmp/arch).rpm" && \
rm "nfpm_$(cat /tmp/arch).rpm"

COPY package.rhel-9 /package.sh
COPY build.sh .
ENTRYPOINT ./build.sh
9 changes: 6 additions & 3 deletions builder/Dockerfile.ubuntu-2004
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ FROM ubuntu:focal

ENV DEBIAN_FRONTEND=noninteractive
ENV OS_IDENTIFIER=ubuntu-2004
ARG NFPM_VERSION=v2.37.1

RUN apt-get update && apt-get upgrade -y

Expand All @@ -26,9 +27,11 @@ RUN apt-get install -y \

RUN pip3 install awscli

RUN curl -LO https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_amd64.deb && \
apt install -y ./nfpm_amd64.deb && \
rm nfpm_amd64.deb
RUN if [ "$(arch)" == "aarch64" ]; then echo arm64; else echo amd64; fi > /tmp/arch

RUN curl -LO "https://github.com/goreleaser/nfpm/releases/download/${NFPM_VERSION}/nfpm_$(cat /tmp/arch).rpm" && \
dnf install -y "nfpm_$(cat /tmp/arch).rpm" && \
rm "nfpm_$(cat /tmp/arch).rpm"

RUN chmod 0777 /opt

Expand Down
9 changes: 6 additions & 3 deletions builder/Dockerfile.ubuntu-2204
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ FROM ubuntu:jammy

ENV DEBIAN_FRONTEND=noninteractive
ENV OS_IDENTIFIER=ubuntu-2204
ARG NFPM_VERSION=v2.37.1

RUN apt-get update && apt-get upgrade -y

Expand All @@ -26,9 +27,11 @@ RUN apt-get install -y \

RUN pip3 install awscli

RUN curl -LO https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_amd64.deb && \
apt install -y ./nfpm_amd64.deb && \
rm nfpm_amd64.deb
RUN if [ "$(arch)" == "aarch64" ]; then echo arm64; else echo amd64; fi > /tmp/arch

RUN curl -LO "https://github.com/goreleaser/nfpm/releases/download/${NFPM_VERSION}/nfpm_$(cat /tmp/arch).rpm" && \
dnf install -y "nfpm_$(cat /tmp/arch).rpm" && \
rm "nfpm_$(cat /tmp/arch).rpm"

RUN chmod 0777 /opt

Expand Down
9 changes: 6 additions & 3 deletions builder/Dockerfile.ubuntu-2404
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ FROM ubuntu:noble

ENV DEBIAN_FRONTEND=noninteractive
ENV OS_IDENTIFIER=ubuntu-2404
ARG NFPM_VERSION=v2.37.1

RUN apt-get update && apt-get upgrade -y

Expand All @@ -26,9 +27,11 @@ RUN apt-get install -y \

RUN pip3 install awscli --break-system-packages

RUN curl -LO https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_amd64.deb && \
apt install -y ./nfpm_amd64.deb && \
rm nfpm_amd64.deb
RUN if [ "$(arch)" == "aarch64" ]; then echo arm64; else echo amd64; fi > /tmp/arch

RUN curl -LO "https://github.com/goreleaser/nfpm/releases/download/${NFPM_VERSION}/nfpm_$(cat /tmp/arch).rpm" && \
dnf install -y "nfpm_$(cat /tmp/arch).rpm" && \
rm "nfpm_$(cat /tmp/arch).rpm"

RUN chmod 0777 /opt

Expand Down
16 changes: 16 additions & 0 deletions builder/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ services:
- PYTHON_VERSION=${PYTHON_VERSION}
- LOCAL_STORE=/tmp/output
build:
args:
NFPM_VERSION: v2.37.1
context: .
dockerfile: Dockerfile.ubuntu-2004
image: python-builds:ubuntu-2004
Expand All @@ -20,6 +22,8 @@ services:
- PYTHON_VERSION=${PYTHON_VERSION}
- LOCAL_STORE=/tmp/output
build:
args:
NFPM_VERSION: v2.37.1
context: .
dockerfile: Dockerfile.ubuntu-2204
image: python-builds:ubuntu-2204
Expand All @@ -32,6 +36,8 @@ services:
- PYTHON_VERSION=${PYTHON_VERSION}
- LOCAL_STORE=/tmp/output
build:
args:
NFPM_VERSION: v2.37.1
context: .
dockerfile: Dockerfile.ubuntu-2404
image: python-builds:ubuntu-2404
Expand All @@ -44,6 +50,8 @@ services:
- PYTHON_VERSION=${PYTHON_VERSION}
- LOCAL_STORE=/tmp/output
build:
args:
NFPM_VERSION: v2.37.1
context: .
dockerfile: Dockerfile.debian-11
image: python-builds:debian-11
Expand All @@ -56,6 +64,8 @@ services:
- PYTHON_VERSION=${PYTHON_VERSION}
- LOCAL_STORE=/tmp/output
build:
args:
NFPM_VERSION: v2.37.1
context: .
dockerfile: Dockerfile.debian-12
image: python-builds:debian-12
Expand All @@ -68,6 +78,8 @@ services:
- PYTHON_VERSION=${PYTHON_VERSION}
- LOCAL_STORE=/tmp/output
build:
args:
NFPM_VERSION: v2.37.1
context: .
dockerfile: Dockerfile.centos-8
image: python-builds:centos-8
Expand All @@ -80,6 +92,8 @@ services:
- PYTHON_VERSION=${PYTHON_VERSION}
- LOCAL_STORE=/tmp/output
build:
args:
NFPM_VERSION: v2.37.1
context: .
dockerfile: Dockerfile.rhel-9
image: python-builds:rhel-9
Expand All @@ -92,6 +106,8 @@ services:
- PYTHON_VERSION=${PYTHON_VERSION}
- LOCAL_STORE=/tmp/output
build:
args:
NFPM_VERSION: v2.37.1
context: .
dockerfile: Dockerfile.opensuse-155
image: python-builds:opensuse-155
Expand Down

0 comments on commit b83ce5f

Please sign in to comment.