-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TASK] Update base image and Node.js
Ubuntu 18.04 is used instead of 16.04 Node.js version 16 is used instead of 8 The build is restructed: a shell script is used to reduce image layer amount and size. Reformat files with Prettier / shfmt. A verify step is added to the GitHub action. # Conflicts: # Dockerfile
- Loading branch information
Showing
6 changed files
with
150 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_style = space | ||
indent_size = 4 | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[{*.sh,Dockerfile}] | ||
binary_next_line = true | ||
switch_case_indent = true | ||
space_redirects = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"editor.defaultFormatter": null, | ||
"[dockerfile]": { | ||
"editor.defaultFormatter": "foxundermoon.shell-format" | ||
}, | ||
"shellformat.flag": "--binary-next-line --case-indent" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,14 @@ | ||
FROM ubuntu:16.04 | ||
FROM ubuntu:18.04 | ||
|
||
# Install dependencies for install scripts. | ||
RUN apt-get update \ | ||
&& apt-get install -y \ | ||
apt-transport-https \ | ||
curl | ||
ARG cypressVersion=3.0.3 | ||
ARG nodeVersion=16 | ||
|
||
# Add Yarn repo | ||
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ | ||
&& echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list | ||
COPY ./build.sh /opt/build.sh | ||
|
||
# Add Chrome repo | ||
RUN curl -sS https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ | ||
&& echo "deb http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
ENV CYPRESS_INSTALL_BINARY="/opt/cypress/cypress.zip" | ||
ENV CYPRESS_VERSION="$cypressVersion" | ||
|
||
# Update package lists and bring all package up to date. | ||
RUN apt-get update \ | ||
&& apt-get dist-upgrade -y | ||
RUN bash /opt/build.sh "${cypressVersion}" "${nodeVersion}" | ||
|
||
# Install Yarn | ||
RUN apt-get install -y yarn | ||
|
||
# Install Node.js | ||
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - \ | ||
&& apt-get install -y nodejs | ||
|
||
# Install Cypress dependencies (separate commands to avoid time outs) | ||
RUN apt-get install -y \ | ||
libgtk2.0-0 | ||
RUN apt-get install -y \ | ||
libnotify-dev | ||
RUN apt-get install -y \ | ||
libgconf-2-4 \ | ||
libnss3 \ | ||
libxss1 | ||
RUN apt-get install -y \ | ||
libasound2 \ | ||
xvfb | ||
|
||
RUN apt-get install -y dbus-x11 google-chrome-stable | ||
|
||
# Download Cypress binary | ||
RUN mkdir /opt/cypress \ | ||
&& curl -sS https://cdn.cypress.io/desktop/3.0.3/linux64/cypress.zip > /opt/cypress/cypress.zip | ||
|
||
# Cleanup | ||
RUN apt-get purge -y \ | ||
apt-transport-https \ | ||
curl \ | ||
&& apt-get --purge -y autoremove \ | ||
&& apt-get autoclean \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
RUN rm /opt/build.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
cypressVersion="$1" | ||
nodeVersion="$2" | ||
|
||
echo "Building for Cypress version ${cypressVersion}" | ||
|
||
# Update package lists and bring all package up to date. | ||
apt-get update | ||
apt-get dist-upgrade -y | ||
|
||
# Install dependencies for install scripts. | ||
apt-get install -y \ | ||
apt-transport-https \ | ||
curl \ | ||
gnupg | ||
|
||
# Install Node.js | ||
curl -sL "https://deb.nodesource.com/setup_${nodeVersion}.x" | bash - | ||
apt-get install -y nodejs | ||
|
||
# Install Yarn | ||
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /usr/share/keyrings/yarnkey.gpg >/dev/null | ||
echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | tee /etc/apt/sources.list.d/yarn.list | ||
apt-get update | ||
apt-get install -y yarn | ||
|
||
# Install Chrome | ||
curl -sL https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor | tee /usr/share/keyrings/googlekey.gpg >/dev/null | ||
echo "deb [signed-by=/usr/share/keyrings/googlekey.gpg] https://dl.google.com/linux/chrome/deb/ stable main" >/etc/apt/sources.list.d/google.list | ||
|
||
# Install Cypress dependencies | ||
apt-get install -y \ | ||
libgtk2.0-0 \ | ||
libgtk-3-0 \ | ||
libgbm-dev \ | ||
libnotify-dev \ | ||
libgconf-2-4 \ | ||
libnss3 \ | ||
libxss1 \ | ||
libasound2 \ | ||
libxtst6 \ | ||
xauth \ | ||
xvfb | ||
|
||
# Download Cypress binary | ||
mkdir /opt/cypress | ||
curl -sS "https://cdn.cypress.io/desktop/${cypressVersion}/linux64/cypress.zip" >/opt/cypress/cypress.zip | ||
|
||
# Cleanup | ||
apt-get purge -y \ | ||
apt-transport-https \ | ||
curl \ | ||
gnupg \ | ||
lsb-release | ||
apt-get --purge -y autoremove | ||
apt-get autoclean | ||
apt-get clean | ||
rm -rf /var/lib/apt/lists/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
cd "$HOME" | ||
|
||
npm install "cypress@${CYPRESS_VERSION}" | ||
|
||
npx cypress verify |