Skip to content

Commit 93ba46b

Browse files
admin-token-botsnyk-boteramongodb
authored
[Snyk] Security upgrade alpine from 3.18 to 3 (#1088)
* fix: extras/docker/alpine3.18/Dockerfile to reduce vulnerabilities The following vulnerabilities are fixed with an upgrade: - https://snyk.io/vuln/SNYK-ALPINE318-OPENSSL-6152404 - https://snyk.io/vuln/SNYK-ALPINE318-OPENSSL-6152404 - https://snyk.io/vuln/SNYK-ALPINE318-OPENSSL-6160000 - https://snyk.io/vuln/SNYK-ALPINE318-OPENSSL-6160000 * Change all references to Alpine 3.18 to Alpine 3 --------- Co-authored-by: snyk-bot <[email protected]> Co-authored-by: Ezra Chung <[email protected]>
1 parent e58dfa6 commit 93ba46b

File tree

6 files changed

+16
-16
lines changed

6 files changed

+16
-16
lines changed

.mci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ functions:
633633
set -x
634634
# TODO: Re-enable Alpine test once MONGOCRYPT-601 is released.
635635
# echo "Building Alpine Docker image"
636-
# make -C extras/docker/alpine3.18 nocachebuild test
636+
# make -C extras/docker/alpine3 nocachebuild test
637637
echo "Building Debian Docker image"
638638
make -C extras/docker/bookworm nocachebuild test
639639
echo "Building Red Hat UBI Docker image"

extras/docker/alpine3.18/Dockerfile renamed to extras/docker/alpine3/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# DO NOT EDIT THIS FILE DIRECTLY
22
# This file was auto generated from the template file Dockerfile.j2 using the generate.py script
33

4-
FROM alpine:3.18 AS builder
4+
FROM alpine:3 AS builder
55

66
ARG MONGOCXX_VERSION=3.9.0
77
ARG MONGOC_VERSION=1.25.4
@@ -60,7 +60,7 @@ RUN wget https://github.com/mongodb/mongo-cxx-driver/archive/refs/tags/r${MONGOC
6060
cmake --build mongocxx-build --config RelWithDebInfo && \
6161
cmake --install mongocxx-build --config RelWithDebInfo --prefix /opt/mongocxx
6262

63-
FROM alpine:3.18
63+
FROM alpine:3
6464

6565
RUN apk update && apk upgrade && apk add --no-cache openssl3 libstdc++ libc6-compat
6666

extras/docker/alpine3.18/Makefile renamed to extras/docker/alpine3/Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@ DOCKER=docker
77
.PHONY: build
88
build:
99
$(DOCKER) build . \
10-
-t mongodb/mongo-cxx-driver:$(MONGOCXX_VERSION)-alpine3.18
10+
-t mongodb/mongo-cxx-driver:$(MONGOCXX_VERSION)-alpine3
1111

1212
.PHONY: nocachebuild
1313
nocachebuild:
1414
$(DOCKER) build . \
1515
--no-cache \
16-
-t mongodb/mongo-cxx-driver:$(MONGOCXX_VERSION)-alpine3.18
16+
-t mongodb/mongo-cxx-driver:$(MONGOCXX_VERSION)-alpine3
1717

1818
.PHONY: run
1919
run: | $(filter nocachebuild build, $(MAKECMDGOALS))
20-
$(DOCKER) run --rm -it mongodb/mongo-cxx-driver:$(MONGOCXX_VERSION)-alpine3.18
20+
$(DOCKER) run --rm -it mongodb/mongo-cxx-driver:$(MONGOCXX_VERSION)-alpine3
2121

2222
.PHONY: test
2323
test: | $(filter nocachebuild build, $(MAKECMDGOALS))
24-
$(DOCKER) build . --no-cache -f TestDockerfile -t test-mongocxx-driver-image:$(MONGOCXX_VERSION)-alpine3.18
25-
$(DOCKER) run test-mongocxx-driver-image:$(MONGOCXX_VERSION)-alpine3.18
24+
$(DOCKER) build . --no-cache -f TestDockerfile -t test-mongocxx-driver-image:$(MONGOCXX_VERSION)-alpine3
25+
$(DOCKER) run test-mongocxx-driver-image:$(MONGOCXX_VERSION)-alpine3

extras/docker/alpine3.18/TestDockerfile renamed to extras/docker/alpine3/TestDockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# DO NOT EDIT THIS FILE DIRECTLY
22
# This file was auto generated from the template file TestDockerfile.j2 using the generate.py script
33

4-
FROM mongodb/mongo-cxx-driver:3.9.0-alpine3.18
4+
FROM mongodb/mongo-cxx-driver:3.9.0-alpine3
55

66
WORKDIR /build
77

extras/docker/alpine3.18/test.cpp renamed to extras/docker/alpine3/test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
int main(void) {
1010
mongocxx::instance inst{};
1111
std::cout << "mongo-cxx-driver version: " << MONGOCXX_VERSION_STRING << std::endl;
12-
std::cout << "THE alpine3.18 IMAGE WORKS!" << std::endl;
12+
std::cout << "THE alpine3 IMAGE WORKS!" << std::endl;
1313
}

extras/docker/generate.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,37 +24,37 @@ def render_template(template_filename, context):
2424
("Dockerfile.j2", "Dockerfile"),
2525
]
2626
distros = [
27-
"alpine3.18",
27+
"alpine3",
2828
"bookworm",
2929
"jammy",
3030
"redhat-ubi-9.3",
3131
]
3232
base_image = {
33-
"alpine3.18": "alpine:3.18",
33+
"alpine3": "alpine:3",
3434
"bookworm": "debian:12-slim",
3535
"jammy": "ubuntu:22.04",
3636
"redhat-ubi-9.3": "registry.access.redhat.com/ubi9/ubi-minimal:9.3",
3737
}
3838
test_dependency_install_command = {
39-
"alpine3.18": "apk update && apk upgrade && apk add --no-cache alpine-sdk",
39+
"alpine3": "apk update && apk upgrade && apk add --no-cache alpine-sdk",
4040
"bookworm": "apt update && apt upgrade -y && apt install -y build-essential",
4141
"jammy": "apt update && apt upgrade -y && apt install -y build-essential",
4242
"redhat-ubi-9.3": "microdnf upgrade -y && microdnf install -y g++",
4343
}
4444
build_dependencies_install_command = {
45-
"alpine3.18": "apk update && apk upgrade && apk add --no-cache alpine-sdk ninja cmake openssl-dev python3",
45+
"alpine3": "apk update && apk upgrade && apk add --no-cache alpine-sdk ninja cmake openssl-dev python3",
4646
"bookworm": "apt update && apt upgrade -y && apt install -y ninja-build build-essential cmake git libssl-dev python3 wget",
4747
"jammy": "apt update && apt upgrade -y && apt install -y ninja-build build-essential cmake git libssl-dev python3 wget",
4848
"redhat-ubi-9.3": "microdnf upgrade -y && microdnf install -y ninja-build gcc g++ git gzip tar wget cmake openssl-devel python3",
4949
}
5050
runtime_dependencies_install_command = {
51-
"alpine3.18": "apk update && apk upgrade && apk add --no-cache openssl3 libstdc++ libc6-compat",
51+
"alpine3": "apk update && apk upgrade && apk add --no-cache openssl3 libstdc++ libc6-compat",
5252
"bookworm": "apt update && apt upgrade -y && apt install -y libssl3 && rm -rf /var/lib/apt/lists/*",
5353
"jammy": "apt update && apt upgrade -y && apt install -y libssl3 && rm -rf /var/lib/apt/lists/*",
5454
"redhat-ubi-9.3": "microdnf upgrade -y && microdnf install -y openssl",
5555
}
5656
post_install_commands = {
57-
"alpine3.18": "",
57+
"alpine3": "",
5858
"bookworm": "\nRUN ldconfig\n",
5959
"jammy": "\nRUN ldconfig\n",
6060
"redhat-ubi-9.3": (

0 commit comments

Comments
 (0)