Move from ubuntu to distroless image (#31136)

* Move from ubuntu to distroless image

* Update updated ubunty image for first stage

* Update server/build/Dockerfile

Co-authored-by: Daniel Schalla <daniel@mattermost.com>

* Update server/build/Dockerfile

Co-authored-by: Daniel Schalla <daniel@mattermost.com>

* Add mising env var for health check

* Add mattermost user in /etc/passwd

* Fix e2e userId

* use cypress in place of server. Wget and not curl

* Simplify e2e changes

---------

Co-authored-by: Daniel Schalla <daniel@mattermost.com>
Этот коммит содержится в:
Eva Sarafianou
2025-06-03 20:52:13 +03:00
коммит произвёл GitHub
родитель 05585e5388
Коммит 0a7be9f034
3 изменённых файлов: 51 добавлений и 13 удалений

Просмотреть файл

@@ -23,11 +23,14 @@ fi
if [ "$TEST" = "cypress" ]; then
mme2e_log "Prepare Cypress: install dependencies"
${MME2E_DC_SERVER} exec -T -u 0 -- cypress bash -c "id $MME2E_UID || useradd -u $MME2E_UID -m nodeci" # Works around the node image's assumption that the app files are owned by user 1000
# Create user in Cypress container and work around the node image's assumption that the app files are owned by user 1000
mme2e_log "Creating user for Cypress container"
${MME2E_DC_SERVER} exec -T -u 0 -- cypress bash -c "id $MME2E_UID || useradd -u $MME2E_UID -m nodeci"
${MME2E_DC_SERVER} exec -T -u "$MME2E_UID" -- cypress npm i
${MME2E_DC_SERVER} exec -T -u "$MME2E_UID" -- cypress cypress install
mme2e_log "Prepare Cypress: populating fixtures"
${MME2E_DC_SERVER} exec -T -u "$MME2E_UID" -- cypress tee tests/fixtures/keycloak.crt >/dev/null <../../server/build/docker/keycloak/keycloak.crt
# Download plugins using wget in the Cypress container
for PLUGIN_URL in \
"https://github.com/mattermost/mattermost-plugin-gitlab/releases/download/v1.3.0/com.github.manland.mattermost-plugin-gitlab-1.3.0.tar.gz" \
"https://github.com/mattermost/mattermost-plugin-demo/releases/download/v0.9.0/com.mattermost.demo-plugin-0.9.0.tar.gz" \
@@ -35,12 +38,16 @@ if [ "$TEST" = "cypress" ]; then
do
PLUGIN_NAME="${PLUGIN_URL##*/}"
PLUGIN_PATH="tests/fixtures/$PLUGIN_NAME"
# Check if file exists
if ${MME2E_DC_SERVER} exec -T -u "$MME2E_UID" -- cypress test -f "$PLUGIN_PATH"; then
mme2e_log "Skipping installation of plugin $PLUGIN_NAME: file exists"
continue
fi
# Use wget in the Cypress container instead of curl in server (for distroless compatibility)
mme2e_log "Downloading $PLUGIN_NAME to fixtures directory"
${MME2E_DC_SERVER} exec -T -- server curl -L --silent "${PLUGIN_URL}" | ${MME2E_DC_SERVER} exec -T -u "$MME2E_UID" -- cypress tee "$PLUGIN_PATH" >/dev/null
${MME2E_DC_SERVER} exec -T -u "$MME2E_UID" -- cypress wget -q -O "/cypress/$PLUGIN_PATH" "$PLUGIN_URL"
done
fi