Merge pull request #91 from ChrisCarini/patch-1

Adding linux/arm64 platform to docker build-push-action
This commit is contained in:
Alicia Sykes 2024-03-06 00:11:51 +00:00 committed by GitHub
commit 195577fe0c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 35 additions and 6 deletions

View File

@ -67,7 +67,7 @@ jobs:
context: . context: .
file: ./Dockerfile file: ./Dockerfile
push: true push: true
platforms: linux/amd64 platforms: linux/amd64,linux/arm64/v8
tags: | tags: |
${{ env.GHCR_TAG }} ${{ env.GHCR_TAG }}
${{ env.DOCKERHUB_TAG }} ${{ env.DOCKERHUB_TAG }}

View File

@ -1,20 +1,46 @@
# Build stage # Specify the Node.js version to use
FROM node:16-buster-slim AS build ARG NODE_VERSION=16
# Specify the Debian version to use, the default is "bullseye"
ARG DEBIAN_VERSION=bullseye
# Use Node.js Docker image as the base image, with specific Node and Debian versions
FROM node:${NODE_VERSION}-${DEBIAN_VERSION} AS build
# Set the container's default shell to Bash and enable some options
SHELL ["/bin/bash", "-euo", "pipefail", "-c"]
# Install Chromium browser and Download and verify Google Chromes signing key
RUN apt-get update -qq --fix-missing && \
apt-get -qqy install --allow-unauthenticated gnupg wget && \
wget --quiet --output-document=- https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor > /etc/apt/trusted.gpg.d/google-archive.gpg && \
echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list && \
apt-get update -qq && \
apt-get -qqy --no-install-recommends install chromium traceroute python make g++ && \
rm -rf /var/lib/apt/lists/*
# Run the Chromium browser's version command and redirect its output to the /etc/chromium-version file
RUN /usr/bin/chromium --no-sandbox --version > /etc/chromium-version
# Set the working directory to /app
WORKDIR /app WORKDIR /app
# Copy package.json and yarn.lock to the working directory
COPY package.json yarn.lock ./ COPY package.json yarn.lock ./
# Run yarn install to install dependencies and clear yarn cache
RUN apt-get update && \ RUN apt-get update && \
yarn install --production && \ yarn install --production --frozen-lockfile --network-timeout 100000 && \
rm -rf /app/node_modules/.cache rm -rf /app/node_modules/.cache
# Copy all files to working directory
COPY . . COPY . .
# Run yarn build to build the application
RUN yarn build --production RUN yarn build --production
# Final stage # Final stage
FROM node:16-buster-slim AS final FROM node:${NODE_VERSION}-${DEBIAN_VERSION} AS final
WORKDIR /app WORKDIR /app
@ -26,8 +52,11 @@ RUN apt-get update && \
chmod 755 /usr/bin/chromium && \ chmod 755 /usr/bin/chromium && \
rm -rf /var/lib/apt/lists/* /app/node_modules/.cache rm -rf /var/lib/apt/lists/* /app/node_modules/.cache
# Exposed container port, the default is 3000, which can be modified through the environment variable PORT
EXPOSE ${PORT:-3000} EXPOSE ${PORT:-3000}
# Set the environment variable CHROME_PATH to specify the path to the Chromium binaries
ENV CHROME_PATH='/usr/bin/chromium' ENV CHROME_PATH='/usr/bin/chromium'
CMD ["yarn", "serve"] # Define the command executed when the container starts and start the server.js of the Node.js application
CMD ["yarn", "serve"]