Skip to content

Commit

Permalink
Make sure dnf always install latest patches when building docker rele…
Browse files Browse the repository at this point in the history
…ase images

Signed-off-by: Peter Zhu <[email protected]>
  • Loading branch information
peterzhuamazon committed Sep 12, 2023
1 parent 9121105 commit e547d92
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 14 deletions.
17 changes: 15 additions & 2 deletions docker/release/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,22 @@
We support building OpenSearch and OpenSearch Dashboards docker for both [multi-CPU](https://docs.docker.com/desktop/multi-arch/) and single CPU architectures.
Users are welcome to choose either type of the image to build on their local development environment, or directly pulling existing images published on Docker Hub:

[OpenSearch Docker Repository](https://hub.docker.com/r/opensearchproject/opensearch/)
[OpenSearch DockerHub Repository](https://hub.docker.com/r/opensearchproject/opensearch/)

[OpenSearch-Dashboards Docker Repository](https://hub.docker.com/r/opensearchproject/opensearch-dashboards/)
[OpenSearch-Dashboards DockerHub Repository](https://hub.docker.com/r/opensearchproject/opensearch-dashboards/)

[OpenSearch ECR Repository](https://gallery.ecr.aws/opensearchproject/opensearch/)

[OpenSearch-Dashboards ECR Repository](https://gallery.ecr.aws/opensearchproject/opensearch-dashboards/)

```
# DockerHub
docker pull opensearchproject/opensearch:latest
docker pull opensearchproject/opensearch-dashboards:latest
# ECR
docker pull public.ecr.aws/opensearchproject/opensearch:latest
docker pull public.ecr.aws/opensearchproject/opensearch-dashboards:latest
```

### Building Docker Images
Expand All @@ -32,6 +41,10 @@ Verify if you have Docker Desktop or Docker Buildx Standalone by running:
You need to run both script within the `opensearch-build/docker/release` folder. Running them
within other path would cause the scripts to fail.


The OpenSearch and OpenSearch-Dashboards Docker image is based on [AmazonLinux container images](https://github.com/amazonlinux/container-images) and sourced directly from the official [AmazonLinux ECR Repository](https://gallery.ecr.aws/amazonlinux/amazonlinux/) to get timely updates.


#### Build single-arch image with these commands:
* OpenSearch 1.0.0 x64:
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# OPENSEARCH_DASHBOARDS_HOME: Optional. Specify the opensearch-dashboards root directory. Defaults to /usr/share/opensearch-dashboards.

########################### Stage 0 ########################
FROM amazonlinux:2 AS linux_stage_0
FROM public.ecr.aws/amazonlinux/amazonlinux:2 AS linux_stage_0

ARG UID=1000
ARG GID=1000
Expand Down Expand Up @@ -47,7 +47,7 @@ RUN tar -xzpf $TEMP_DIR/opensearch-dashboards-`uname -p`.tgz -C $OPENSEARCH_DASH

########################### Stage 1 ########################
# Copy working directory to the actual release docker images
FROM amazonlinux:2
FROM public.ecr.aws/amazonlinux/amazonlinux:2

ARG UID=1000
ARG GID=1000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# OPENSEARCH_DASHBOARDS_HOME: Optional. Specify the opensearch-dashboards root directory. Defaults to /usr/share/opensearch-dashboards.

########################### Stage 0 ########################
FROM amazonlinux:2023 AS linux_stage_0
FROM public.ecr.aws/amazonlinux/amazonlinux:2023 AS linux_stage_0

ARG UID=1000
ARG GID=1000
Expand All @@ -24,7 +24,7 @@ ARG OPENSEARCH_DASHBOARDS_HOME=/usr/share/opensearch-dashboards
# Update packages
# Install the tools we need: tar and gzip to unpack the OpenSearch tarball, and shadow-utils to give us `groupadd` and `useradd`.
# Install which to allow running of securityadmin.sh
RUN dnf update -y && dnf install -y tar gzip shadow-utils which && dnf clean all
RUN dnf update --releasever=latest -y && dnf install -y tar gzip shadow-utils which && dnf clean all

# Create an opensearch-dashboards user, group, and directory
RUN groupadd -g $GID opensearch-dashboards && \
Expand All @@ -48,7 +48,7 @@ RUN tar -xzpf $TEMP_DIR/opensearch-dashboards-`uname -p`.tgz -C $OPENSEARCH_DASH

########################### Stage 1 ########################
# Copy working directory to the actual release docker images
FROM amazonlinux:2023
FROM public.ecr.aws/amazonlinux/amazonlinux:2023

ARG UID=1000
ARG GID=1000
Expand All @@ -57,7 +57,7 @@ ARG OPENSEARCH_DASHBOARDS_HOME=/usr/share/opensearch-dashboards
# Update packages
# Install the tools we need: tar and gzip to unpack the OpenSearch tarball, and shadow-utils to give us `groupadd` and `useradd`.
# Install which to allow running of securityadmin.sh
RUN dnf update -y && dnf install -y tar gzip shadow-utils which && dnf clean all
RUN dnf update --releasever=latest -y && dnf install -y tar gzip shadow-utils which && dnf clean all

# Install Reporting dependencies
RUN dnf install -y nss xorg-x11-fonts-100dpi xorg-x11-fonts-75dpi xorg-x11-utils xorg-x11-fonts-cyrillic xorg-x11-fonts-Type1 xorg-x11-fonts-misc fontconfig freetype && dnf clean all
Expand Down
4 changes: 2 additions & 2 deletions docker/release/dockerfiles/opensearch.al2.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


########################### Stage 0 ########################
FROM amazonlinux:2 AS linux_stage_0
FROM public.ecr.aws/amazonlinux/amazonlinux:2 AS linux_stage_0

ARG UID=1000
ARG GID=1000
Expand Down Expand Up @@ -50,7 +50,7 @@ RUN ls -l $TEMP_DIR && \

########################### Stage 1 ########################
# Copy working directory to the actual release docker images
FROM amazonlinux:2
FROM public.ecr.aws/amazonlinux/amazonlinux:2

ARG UID=1000
ARG GID=1000
Expand Down
8 changes: 4 additions & 4 deletions docker/release/dockerfiles/opensearch.al2023.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


########################### Stage 0 ########################
FROM amazonlinux:2023 AS linux_stage_0
FROM public.ecr.aws/amazonlinux/amazonlinux:2023 AS linux_stage_0

ARG UID=1000
ARG GID=1000
Expand All @@ -27,7 +27,7 @@ ARG PERFORMANCE_ANALYZER_PLUGIN_CONFIG_DIR=$OPENSEARCH_PATH_CONF/opensearch-perf
# Update packages
# Install the tools we need: tar and gzip to unpack the OpenSearch tarball, and shadow-utils to give us `groupadd` and `useradd`.
# Install which to allow running of securityadmin.sh
RUN dnf update -y && dnf install -y tar gzip shadow-utils which && dnf clean all
RUN dnf update --releasever=latest -y && dnf install -y tar gzip shadow-utils which && dnf clean all

# Create an opensearch user, group, and directory
RUN groupadd -g $GID opensearch && \
Expand All @@ -50,7 +50,7 @@ RUN ls -l $TEMP_DIR && \

########################### Stage 1 ########################
# Copy working directory to the actual release docker images
FROM amazonlinux:2023
FROM public.ecr.aws/amazonlinux/amazonlinux:2023

ARG UID=1000
ARG GID=1000
Expand All @@ -59,7 +59,7 @@ ARG OPENSEARCH_HOME=/usr/share/opensearch
# Update packages
# Install the tools we need: tar and gzip to unpack the OpenSearch tarball, and shadow-utils to give us `groupadd` and `useradd`.
# Install which to allow running of securityadmin.sh
RUN dnf update -y && dnf install -y tar gzip shadow-utils which && dnf clean all
RUN dnf update --releasever=latest -y && dnf install -y tar gzip shadow-utils which && dnf clean all

# Create an opensearch user, group
RUN groupadd -g $GID opensearch && \
Expand Down

0 comments on commit e547d92

Please sign in to comment.