diff --git a/.github/workflows/build-base-image.yml b/.github/workflows/build-base-image.yml deleted file mode 100644 index 431ea6f..0000000 --- a/.github/workflows/build-base-image.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Build and Push Base Image - -on: - push: - branches: [main] - paths: [Dockerfile.base] - workflow_dispatch: - -env: - IMAGE_NAME: ghcr.io/shopify/lighthouse-ci-action - IMAGE_TAG: "3.0.0" - -jobs: - build-and-push: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - - name: Log in to GitHub Container Registry - uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build base image - run: docker build -t ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} -f Dockerfile.base . - - - name: Push base image - run: docker push ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} diff --git a/Dockerfile b/Dockerfile index 2c710c4..1535f0f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,27 @@ -FROM cpclermont/lighthouse-ci-action:2.0.0 +FROM node:20-bookworm + +# Install system dependencies +RUN apt-get update \ + && apt-get -y install sudo jq \ + && apt-get clean + +# Install latest chrome stable package (using signed-by for Bookworm compatibility). +RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor -o /usr/share/keyrings/google-chrome.gpg \ + && echo "deb [arch=amd64 signed-by=/usr/share/keyrings/google-chrome.gpg] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list \ + && apt-get update \ + && apt-get install -y google-chrome-stable --no-install-recommends \ + && apt-get clean + +# Install puppeteer and LHCI +ENV npm_config_prefix="$GITHUB_WORKSPACE/.node" +ENV PATH="$npm_config_prefix:${PATH}" +RUN mkdir -p "$npm_config_prefix" \ + && chmod -R 777 "$npm_config_prefix" \ + && umask 000 \ + && npm install -g @lhci/cli@0.13.x lighthouse puppeteer + +# Install Shopify CLI RUN npm install -g @shopify/cli @shopify/theme + COPY entrypoint.sh /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] diff --git a/Dockerfile.base b/Dockerfile.base deleted file mode 100644 index ca7990a..0000000 --- a/Dockerfile.base +++ /dev/null @@ -1,27 +0,0 @@ -FROM node:20-bookworm - -ENV PATH="/root/.rbenv/shims:${PATH}" - -# Install dependencies -RUN apt-get update \ - && apt-get -y install sudo jq rbenv \ - && mkdir -p "$(rbenv root)"/plugins \ - && git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build \ - && git -C "$(rbenv root)"/plugins/ruby-build pull \ - && rbenv install 3.2.0 \ - && rbenv global 3.2.0 - -# Install latest chrome stable package (using signed-by for Bookworm compatibility). -RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor -o /usr/share/keyrings/google-chrome.gpg \ - && echo "deb [arch=amd64 signed-by=/usr/share/keyrings/google-chrome.gpg] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list \ - && apt-get update \ - && apt-get install -y google-chrome-stable --no-install-recommends \ - && apt-get clean - -# install puppeteer and stuff -ENV npm_config_prefix="$GITHUB_WORKSPACE/.node" -ENV PATH="$npm_config_prefix:${PATH}" -RUN mkdir -p "$npm_config_prefix" \ - && chmod -R 777 "$npm_config_prefix" \ - && umask 000 \ - && npm install -g @lhci/cli@0.13.x lighthouse puppeteer diff --git a/Makefile b/Makefile index 7da3122..117821e 100644 --- a/Makefile +++ b/Makefile @@ -1,18 +1,8 @@ -PROJECT_NAME := cpclermont/lighthouse-ci-action -VERSION := 2.0.0 -GITSHA:= $(shell echo $$(git describe --always --long --dirty)) +PROJECT_NAME := lighthouse-ci-action +GITSHA := $(shell git describe --always --long --dirty) -export GITSHA -export VERSION +build: + DOCKER_BUILDKIT=1 docker build -t $(PROJECT_NAME):$(GITSHA) -t $(PROJECT_NAME):local . -base: Dockerfile - DOCKER_BUILDKIT=1 docker build -t $(PROJECT_NAME):$(VERSION) -t $(PROJECT_NAME):$(GITSHA) - < Dockerfile.base - -push: base - docker push $(PROJECT_NAME):$(VERSION) - -runner: base - DOCKER_BUILDKIT=1 docker build -t $(PROJECT_NAME)-runner:$(VERSION) -t $(PROJECT_NAME)-runner:$(GITSHA) . - -ssh: runner - docker run -it --entrypoint /bin/bash $(PROJECT_NAME)-runner:$(VERSION) +ssh: build + docker run -it --entrypoint /bin/bash $(PROJECT_NAME):local