Skip to content

Commit

Permalink
Remove MySQL/Percona lite tags
Browse files Browse the repository at this point in the history
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>

Switch from root to vitess users when installing packages

Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>

debug - use frouioui as the docker account

Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>

debug - use frouioui for the lite image

Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>

revert wip and debug

Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
  • Loading branch information
frouioui committed Apr 1, 2024
1 parent fabd746 commit cd31ff4
Show file tree
Hide file tree
Showing 31 changed files with 157 additions and 754 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker_build_lite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
strategy:
fail-fast: true
matrix:
branch: [ latest, mysql57, mysql80, percona57, percona80 ]
branch: [ latest ]

steps:
- name: Check out code
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ $(PROTO_GO_OUTS): minimaltools install_protoc-gen-go proto/*.proto
# This rule builds the bootstrap images for all flavors.
DOCKER_IMAGES_FOR_TEST = mysql57 mysql80 percona57 percona80
DOCKER_IMAGES = common $(DOCKER_IMAGES_FOR_TEST)
BOOTSTRAP_VERSION=29
BOOTSTRAP_VERSION=30
ensure_bootstrap_version:
find docker/ -type f -exec sed -i "s/^\(ARG bootstrap_version\)=.*/\1=${BOOTSTRAP_VERSION}/" {} \;
sed -i 's/\(^.*flag.String(\"bootstrap-version\",\) *\"[^\"]\+\"/\1 \"${BOOTSTRAP_VERSION}\"/' test.go
Expand Down Expand Up @@ -331,7 +331,7 @@ docker_base_all: docker_base $(DOCKER_BASE_TARGETS)
docker_lite:
${call build_docker_image,docker/lite/Dockerfile,vitess/lite}

DOCKER_LITE_SUFFIX = mysql57 ubi7.mysql57 mysql80 ubi7.mysql80 percona57 ubi7.percona57 percona80 ubi7.percona80 testing ubi8.mysql80 ubi8.arm64.mysql80
DOCKER_LITE_SUFFIX = testing ubi7 ubi8 ubi8.arm64
DOCKER_LITE_TARGETS = $(addprefix docker_lite_,$(DOCKER_LITE_SUFFIX))
$(DOCKER_LITE_TARGETS): docker_lite_%:
${call build_docker_image,docker/lite/Dockerfile.$*,vitess/lite:$*}
Expand Down
2 changes: 1 addition & 1 deletion docker/base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

ARG bootstrap_version=29
ARG bootstrap_version=30
ARG image="vitess/bootstrap:${bootstrap_version}-mysql80"

FROM "${image}"
Expand Down
2 changes: 1 addition & 1 deletion docker/base/Dockerfile.mysql57
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

ARG bootstrap_version=29
ARG bootstrap_version=30
ARG image="vitess/bootstrap:${bootstrap_version}-mysql57"

FROM "${image}"
Expand Down
2 changes: 1 addition & 1 deletion docker/base/Dockerfile.percona57
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

ARG bootstrap_version=29
ARG bootstrap_version=30
ARG image="vitess/bootstrap:${bootstrap_version}-percona57"

FROM "${image}"
Expand Down
2 changes: 1 addition & 1 deletion docker/base/Dockerfile.percona80
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

ARG bootstrap_version=29
ARG bootstrap_version=30
ARG image="vitess/bootstrap:${bootstrap_version}-percona80"

FROM "${image}"
Expand Down
6 changes: 5 additions & 1 deletion docker/bootstrap/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,8 @@ List of changes between bootstrap image versions.

## [29] - 2024-03-05
### Changes
- Update build to golang 1.22.1
- Update build to golang 1.22.1

## [30] - 2024-04-01
### Changes
- Move the bootstrap phase to the common image so other Dockerfiles don't have to rely on the version based tags.
6 changes: 6 additions & 0 deletions docker/bootstrap/Dockerfile.common
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,11 @@ VOLUME /vt/vtdataroot
# Add compatibility to the previous layout for now
RUN su vitess -c "mkdir -p /vt/src/vitess.io/vitess/bin && rm -rf /vt/bin && ln -s /vt/src/vitess.io/vitess/bin /vt/bin"

# Bootstrap Vitess
WORKDIR /vt/src/vitess.io/vitess

USER vitess
RUN ./bootstrap.sh

# If the user doesn't specify a command, load a shell.
CMD ["/bin/bash"]
6 changes: 2 additions & 4 deletions docker/bootstrap/Dockerfile.mysql57
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ ARG image="vitess/bootstrap:${bootstrap_version}-common"

FROM --platform=linux/amd64 "${image}"

USER root

# Install MySQL 5.7
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends gnupg dirmngr ca-certificates && \
for i in $(seq 1 10); do apt-key adv --no-tty --recv-keys --keyserver keyserver.ubuntu.com A8D3785C && break; done && \
Expand All @@ -18,8 +20,4 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-ins
DEBIAN_FRONTEND=noninteractive apt-get install -y mysql-server libmysqlclient-dev libdbd-mysql-perl rsync libev4 percona-xtrabackup-24 && \
rm -rf /var/lib/apt/lists/*

# Bootstrap Vitess
WORKDIR /vt/src/vitess.io/vitess

USER vitess
RUN ./bootstrap.sh
6 changes: 2 additions & 4 deletions docker/bootstrap/Dockerfile.mysql80
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ ARG image="vitess/bootstrap:${bootstrap_version}-common"

FROM --platform=linux/amd64 "${image}"

USER root

# Install MySQL 8.0
RUN for i in $(seq 1 10); do apt-key adv --no-tty --recv-keys --keyserver keyserver.ubuntu.com 8C718D3B5072E1F5 && break; done && \
for i in $(seq 1 10); do apt-key adv --no-tty --recv-keys --keyserver keyserver.ubuntu.com A8D3785C && break; done && \
Expand All @@ -18,8 +20,4 @@ RUN for i in $(seq 1 10); do apt-key adv --no-tty --recv-keys --keyserver keyser
DEBIAN_FRONTEND=noninteractive apt-get install -y mysql-server libmysqlclient-dev libdbd-mysql-perl rsync libev4 libcurl4-openssl-dev percona-xtrabackup-80 && \
rm -rf /var/lib/apt/lists/*

# Bootstrap Vitess
WORKDIR /vt/src/vitess.io/vitess

USER vitess
RUN ./bootstrap.sh
6 changes: 2 additions & 4 deletions docker/bootstrap/Dockerfile.percona57
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ ARG image="vitess/bootstrap:${bootstrap_version}-common"

FROM --platform=linux/amd64 "${image}"

USER root

# Install Percona 5.7
RUN for i in $(seq 1 10); do apt-key adv --no-tty --keyserver keyserver.ubuntu.com --recv-keys 9334A25F8507EFA5 && break; done && \
add-apt-repository 'deb http://repo.percona.com/apt bullseye main' && \
Expand All @@ -16,8 +18,4 @@ RUN for i in $(seq 1 10); do apt-key adv --no-tty --keyserver keyserver.ubuntu.c
apt-get install -y --no-install-recommends libperconaserverclient20-dev percona-xtrabackup-24 && \
rm -rf /var/lib/apt/lists/*

# Bootstrap Vitess
WORKDIR /vt/src/vitess.io/vitess

USER vitess
RUN ./bootstrap.sh
6 changes: 2 additions & 4 deletions docker/bootstrap/Dockerfile.percona80
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ ARG image="vitess/bootstrap:${bootstrap_version}-common"

FROM --platform=linux/amd64 "${image}"

USER root

# Install Percona 8.0
RUN for i in $(seq 1 10); do apt-key adv --no-tty --keyserver keyserver.ubuntu.com --recv-keys 9334A25F8507EFA5 && break; done \
&& echo 'deb http://repo.percona.com/ps-80/apt bullseye main' > /etc/apt/sources.list.d/percona.list && \
Expand Down Expand Up @@ -31,8 +33,4 @@ RUN for i in $(seq 1 10); do apt-key adv --no-tty --keyserver keyserver.ubuntu.c
&& apt-get install -y --no-install-recommends percona-xtrabackup-80 \
&& rm -rf /var/lib/apt/lists/*

# Bootstrap Vitess
WORKDIR /vt/src/vitess.io/vitess

USER vitess
RUN ./bootstrap.sh
1 change: 0 additions & 1 deletion docker/lite/Dockerfile

This file was deleted.

54 changes: 54 additions & 0 deletions docker/lite/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Copyright 2019 The Vitess Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: We have to build the Vitess binaries from scratch instead of sharing
# a base image because Docker Hub dropped the feature we relied upon to
# ensure images contain the right binaries.

# Use a temporary layer for the build stage.
ARG bootstrap_version=30
ARG image="vitess/bootstrap:${bootstrap_version}-common"

FROM "${image}" AS builder

# Allows docker builds to set the BUILD_NUMBER
ARG BUILD_NUMBER

# Re-copy sources from working tree.
COPY --chown=vitess:vitess . /vt/src/vitess.io/vitess

# Build and install Vitess in a temporary output directory.
USER vitess

RUN make install PREFIX=/vt/install

# Start over and build the final image.
FROM debian:bullseye-slim

# Set up Vitess user and directory tree.
RUN groupadd -r vitess && useradd -r -g vitess vitess
RUN mkdir -p /vt/vtdataroot && chown -R vitess:vitess /vt

# Set up Vitess environment (just enough to run pre-built Go binaries)
ENV VTROOT /vt/src/vitess.io/vitess
ENV VTDATAROOT /vt/vtdataroot
ENV PATH $VTROOT/bin:$PATH

# Copy artifacts from builder layer.
COPY --from=builder --chown=vitess:vitess /vt/install /vt
COPY --from=builder --chown=vitess:vitess /vt/src/vitess.io/vitess/web/vtadmin /vt/web/vtadmin

# Create mount point for actual data (e.g. MySQL data dir)
VOLUME /vt/vtdataroot
USER vitess
57 changes: 0 additions & 57 deletions docker/lite/Dockerfile.percona80

This file was deleted.

9 changes: 3 additions & 6 deletions docker/lite/Dockerfile.testing
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
# ensure images contain the right binaries.

# Use a temporary layer for the build stage.
ARG bootstrap_version=29
ARG image="vitess/bootstrap:${bootstrap_version}-mysql57"
ARG bootstrap_version=30
ARG image="vitess/bootstrap:${bootstrap_version}-common"

FROM "${image}" AS builder

Expand All @@ -30,15 +30,12 @@ COPY --chown=vitess:vitess . /vt/src/vitess.io/vitess

# Build and install Vitess in a temporary output directory.
USER vitess

RUN make install-testing PREFIX=/vt/install

# Start over and build the final image.
FROM debian:bullseye-slim

# Install dependencies
COPY docker/lite/install_dependencies.sh /vt/dist/install_dependencies.sh
RUN /vt/dist/install_dependencies.sh mysql57

# Set up Vitess user and directory tree.
RUN groupadd -r vitess && useradd -r -g vitess vitess
RUN mkdir -p /vt/vtdataroot && chown -R vitess:vitess /vt
Expand Down
34 changes: 23 additions & 11 deletions docker/lite/Dockerfile.mysql80 → docker/lite/Dockerfile.ubi7
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Copyright 2019 The Vitess Authors.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -17,8 +17,8 @@
# ensure images contain the right binaries.

# Use a temporary layer for the build stage.
ARG bootstrap_version=29
ARG image="vitess/bootstrap:${bootstrap_version}-mysql80"
ARG bootstrap_version=30
ARG image="vitess/bootstrap:${bootstrap_version}-common"

FROM "${image}" AS builder

Expand All @@ -30,17 +30,14 @@ COPY --chown=vitess:vitess . /vt/src/vitess.io/vitess

# Build and install Vitess in a temporary output directory.
USER vitess

RUN make install PREFIX=/vt/install

# Start over and build the final image.
FROM debian:bullseye-slim

# Install dependencies
COPY docker/lite/install_dependencies.sh /vt/dist/install_dependencies.sh
RUN /vt/dist/install_dependencies.sh mysql80
FROM registry.access.redhat.com/ubi7/ubi:latest

# Set up Vitess user and directory tree.
RUN groupadd -r vitess && useradd -r -g vitess vitess
RUN groupadd -g 1001 -r vitess && useradd -r -u 1001 -g vitess vitess
RUN mkdir -p /vt/vtdataroot && chown -R vitess:vitess /vt

# Set up Vitess environment (just enough to run pre-built Go binaries)
Expand All @@ -52,6 +49,21 @@ ENV PATH $VTROOT/bin:$PATH
COPY --from=builder --chown=vitess:vitess /vt/install /vt
COPY --from=builder --chown=vitess:vitess /vt/src/vitess.io/vitess/web/vtadmin /vt/web/vtadmin

RUN mkdir -p /licenses
COPY LICENSE /licenses

# Create mount point for actual data (e.g. MySQL data dir)
VOLUME /vt/vtdataroot
USER vitess

LABEL name="Vitess Lite image - MySQL Community Server 8.0" \
io.k8s.display-name="Vitess Lite image - MySQL Community Server 8.0" \
maintainer="cncf-vitess-maintainers@lists.cncf.io" \
vendor="CNCF" \
version="6.0.0" \
release="1" \
summary="Vitess base container image, containing Vitess components along with MySQL Community Server 8.0" \
description="Vitess base container image, containing Vitess components along with MySQL Community Server 8.0" \
io.k8s.description="Vitess base container image, containing Vitess components along with MySQL Community Server 8.0" \
distribution-scope="public" \
url="https://vitess.io"
Loading

0 comments on commit cd31ff4

Please sign in to comment.