Skip to content

Commit

Permalink
Add Amazon Linux 2023 support (#355)
Browse files Browse the repository at this point in the history
Add amazon linux 2023 support
  • Loading branch information
dhurley authored Jun 30, 2023
1 parent ec22400 commit 1bd2513
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 13 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ jobs:
version: "9"
- image: "amazonlinux"
version: "2"
- image: "amazonlinux"
version: "2023"
- image: "oraclelinux"
version: "7"
- image: "oraclelinux"
Expand Down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ DATE = $(shell date +%F_%H-%M-%S)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# | OS_RELEASE | OS_VERSION | NOTES |
# | ---------------- | ----------------------------- | -------------------------------------------------------------- |
# | amazonlinux | 2 | |
# | amazonlinux | 2, 2023 | |
# | ubuntu | 18.04, 20.04, 22.04 | |
# | debian | bullseye-slim, buster-slim | |
# | centos | 7 | |
Expand Down Expand Up @@ -268,10 +268,12 @@ oss-image: ## Build agent container image for NGINX OSS
@echo Building image with $(CONTAINER_CLITOOL); \
$(CONTAINER_BUILDENV) $(CONTAINER_CLITOOL) build -t ${IMAGE_TAG} . \
--no-cache -f ./scripts/docker/nginx-oss/${CONTAINER_OS_TYPE}/Dockerfile \
--target install-agent-local
--target install-agent-local \
--build-arg PACKAGE_NAME=${PACKAGE_NAME} \
--build-arg PACKAGES_REPO=${OSS_PACKAGES_REPO} \
--build-arg BASE_IMAGE=${BASE_IMAGE} \
--build-arg OS_RELEASE=${OS_RELEASE} \
--build-arg OS_VERSION=${OS_VERSION} \
--build-arg ENTRY_POINT=./scripts/docker/entrypoint.sh

run-container: ## Run container from specified IMAGE_TAG
Expand Down
7 changes: 2 additions & 5 deletions Makefile.packaging
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ APK_VERSIONS?=3.13 3.14 3.15 3.16 3.17
APK_ARCHS?=aarch64 x86_64
ALMA_VERSIONS?=almalinux-8 almalinux-9
ALMA_ARCHS?=aarch64 x86_64
AMAZON_VERSIONS?=amazon-2
AMAZON_VERSIONS?=amazon-2 amazon-2023
AMAZON_ARCHS?=aarch64 x86_64

UPLOAD_URL := "https://up-ap.nginx.com/"
Expand Down Expand Up @@ -136,10 +136,7 @@ package: gpg-key $(PACKAGES_DIR) $(GITHUB_PACKAGES_DIR) $(AZURE_PACKAGES_DIR) ##
goarch=amd64; \
if [ "$$arch" = "aarch64" ]; then goarch="arm64"; fi; \
GOWORK=off CGO_ENABLED=0 GOARCH=$${goarch} GOOS=linux go build -ldflags=${LDFLAGS} -o ./build/nginx-agent; \
for distro in $(AMAZON_VERSIONS); do \
rpm_distro=`echo $$distro | cut -d- -f 1`; \
rpm_major=`echo $$distro | cut -d- -f 2`; \
rpm_codename="amazon$$rpm_major"; \
for rpm_codename in $(AMAZON_VERSIONS); do \
VERSION=$(shell echo ${VERSION} | tr -d 'v') ARCH=$${arch} nfpm pkg --config .nfpm.yaml --packager rpm --target $(PACKAGES_DIR)/rpm/${PACKAGE_PREFIX}-$(shell echo ${VERSION} | tr -d 'v').$${rpm_codename}.ngx.$${arch}.rpm; \
cp $(PACKAGES_DIR)/rpm/${PACKAGE_PREFIX}-$(shell echo ${VERSION} | tr -d 'v').$${rpm_codename}.ngx.$${arch}.rpm ${GITHUB_PACKAGES_DIR}/${PACKAGE_PREFIX}-$(shell echo ${VERSION} | tr -d 'v').$${rpm_codename}.ngx.$${arch}.rpm; \
cp $(PACKAGES_DIR)/rpm/${PACKAGE_PREFIX}-$(shell echo ${VERSION} | tr -d 'v').$${rpm_codename}.ngx.$${arch}.rpm ${AZURE_PACKAGES_DIR}/${PACKAGE_PREFIX}-$(shell echo ${VERSION} | tr -d 'v').$${rpm_codename}.ngx.$${arch}.rpm; \
Expand Down
3 changes: 3 additions & 0 deletions hugo/content/technical-specifications.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ Alpine Linux
- 3.16 (x86_64, aarch64)
- 3.17 (x86_64, aarch64)

Amazon Linux
- 2023 (x86_64, aarch64)

Amazon Linux 2
- LTS (x86_64, aarch64)

Expand Down
24 changes: 18 additions & 6 deletions scripts/docker/nginx-oss/rpm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ FROM ${BASE_IMAGE} as install-nginx
LABEL maintainer="NGINX Agent Maintainers <[email protected]>"

ARG PACKAGES_REPO
ARG NGINX_CONF
ARG ENTRY_POINT
ARG OS_VERSION
ARG OS_RELEASE
Expand All @@ -16,6 +15,15 @@ RUN if [ "$OS_VERSION" = "7" ] && [ "$OS_RELEASE" = "oraclelinux" ]; \
then yum install -y oracle-epel-release-el7; \
fi

RUN if [ "$OS_VERSION" = "2" ] && [ "$OS_RELEASE" = "amazonlinux" ]; \
then amazon-linux-extras enable epel && yum clean metadata \
&& yum install -y epel-release; \
fi

RUN if [ "$OS_RELEASE" = "amazonlinux" ]; \
then yum install -y shadow-utils; \
fi

RUN if [ "$OS_RELEASE" = "centos" ] && [ "$OS_VERSION" = "7" ]; \
then yum install -y epel-release; \
fi
Expand All @@ -28,10 +36,6 @@ gpgcheck=0 \n\
enabled=1" > /etc/yum.repos.d/nginx.repo; \
fi

RUN if [ "$OS_RELEASE" = "amazonlinux" ]; \
then amazon-linux-extras enable epel && yum clean metadata \
&& yum install -y epel-release shadow-utils; \
fi

RUN set -x \
&& groupadd --system --gid 101 nginx \
Expand All @@ -45,7 +49,15 @@ RUN set -x \
nginx

# Setup nginx agent repository
RUN if [ "$OS_RELEASE" = "amazonlinux" ]; \
RUN if [ "$OS_VERSION" = "2023" ] && [ "$OS_RELEASE" = "amazonlinux" ]; \
then printf "[nginx-agent] \n\
name=nginx-agent repo \n\
baseurl=http://${PACKAGES_REPO}/nginx-agent/amzn/${OS_VERSION}/\$basearch \n\
gpgcheck=1 \n\
enabled=1 \n\
gpgkey=https://nginx.org/keys/nginx_signing.key \n\
module_hotfixes=true" > /etc/yum.repos.d/nginx-agent.repo; \
elif [ "$OS_VERSION" = "2" ] && [ "$OS_RELEASE" = "amazonlinux" ]; \
then printf "[nginx-agent] \n\
name=nginx-agent repo \n\
baseurl=http://${PACKAGES_REPO}/nginx-agent/amzn2/${OS_VERSION}/\$basearch \n\
Expand Down

0 comments on commit 1bd2513

Please sign in to comment.