From b3517a8d429db11a94011dfd48d266d67004fd70 Mon Sep 17 00:00:00 2001 From: Jian Liao Date: Tue, 31 Jan 2023 18:59:25 -0800 Subject: [PATCH] Enable building docker image from Apple M1 --- artifactory-docker/Dockerfile | 8 ++---- artifactory-docker/Playwright_Dockerfile | 5 ++-- artifactory-docker/local.conf | 31 ------------------------ package.json | 6 ++--- 4 files changed, 7 insertions(+), 43 deletions(-) delete mode 100644 artifactory-docker/local.conf diff --git a/artifactory-docker/Dockerfile b/artifactory-docker/Dockerfile index dc8d8fa13..2bd30e58f 100644 --- a/artifactory-docker/Dockerfile +++ b/artifactory-docker/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:latest +FROM node:18-alpine ARG BACKSTOPJS_VERSION @@ -24,18 +24,14 @@ RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/main" > /etc/apk/repositorie ttf-cantarell \ font-noto-emoji \ wqy-zenhei \ - nodejs \ - yarn \ && rm -rf /var/cache/* \ && mkdir /var/cache/apk -COPY local.conf /etc/fonts/local.conf - # Tell Puppeteer to skip installing Chrome. We'll be using the installed package. ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \ PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser -RUN yarn global add backstopjs-spectrum@${BACKSTOPJS_VERSION} +RUN npm i -g backstopjs-spectrum@${BACKSTOPJS_VERSION} # Setup adobe clean font RUN wget --no-check-certificate https://spectrum-resources.corp.adobe.com/fonts/AdobeClean.zip -O AdobeClean.zip \ diff --git a/artifactory-docker/Playwright_Dockerfile b/artifactory-docker/Playwright_Dockerfile index 161d0dd3e..b0c7247f2 100644 --- a/artifactory-docker/Playwright_Dockerfile +++ b/artifactory-docker/Playwright_Dockerfile @@ -1,9 +1,10 @@ -FROM mcr.microsoft.com/playwright:jammy +FROM mcr.microsoft.com/playwright:next ARG BACKSTOPJS_VERSION ENV \ - BACKSTOPJS_VERSION=$BACKSTOPJS_VERSION + BACKSTOPJS_VERSION=$BACKSTOPJS_VERSION \ + PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true # Base packages # RUN apt-get update && \ diff --git a/artifactory-docker/local.conf b/artifactory-docker/local.conf deleted file mode 100644 index e8832cc27..000000000 --- a/artifactory-docker/local.conf +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - sans-serif - - Main sans-serif font name goes here - Noto Color Emoji - Noto Emoji - - - - - serif - - Main serif font name goes here - Noto Color Emoji - Noto Emoji - - - - - monospace - - Main monospace font name goes here - Noto Color Emoji - Noto Emoji - - - diff --git a/package.json b/package.json index 0cb3fb79d..d95be5ddf 100644 --- a/package.json +++ b/package.json @@ -32,10 +32,8 @@ "build-and-copy-report-bundle": "npm run build-compare && npm run copy-report-bundle", "remote": "cd test/configs/ && node ../../cli/index.js remote", "stop": "curl http://localhost:3000/stop", - "build-docker": "PV=$(node -p -e \"require('./package.json').version\"); docker build artifactory-docker --build-arg BACKSTOPJS_VERSION=$PV -t docker-adobe-spectrum-release.dr.corp.adobe.com/backstopjs-spectrum:$PV", - "push-docker": "PV=$(node -p -e \"require('./package.json').version\"); docker push docker-adobe-spectrum-release.dr.corp.adobe.com/backstopjs-spectrum:$PV", - "build-playwright-docker": "PV=$(node -p -e \"require('./package.json').version\"); docker build -f ./artifactory-docker/Playwright_Dockerfile --build-arg BACKSTOPJS_VERSION=$PV -t docker-adobe-spectrum-release.dr.corp.adobe.com/backstopjs-spectrum-playwright:$PV .", - "push-playwright-docker": "PV=$(node -p -e \"require('./package.json').version\"); docker push docker-adobe-spectrum-release.dr.corp.adobe.com/backstopjs-spectrum-playwright:$PV" + "build-push-docker": "PV=$(node -p -e \"require('./package.json').version\"); docker buildx build -f ./artifactory-docker/Dockerfile --platform linux/arm64,linux/amd64 --build-arg BACKSTOPJS_VERSION=$PV --push -t docker-adobe-spectrum-release.dr.corp.adobe.com/backstopjs-spectrum:$PV .", + "build-push-playwright-docker": "PV=$(node -p -e \"require('./package.json').version\"); docker buildx build -f ./artifactory-docker/Playwright_Dockerfile --platform linux/arm64,linux/amd64 --build-arg BACKSTOPJS_VERSION=$PV --push -t docker-adobe-spectrum-release.dr.corp.adobe.com/backstopjs-spectrum-playwright:$PV ." }, "lint-staged": { "compare/src/**/*.js": [