ci: change base image from Debian to Ubuntu 18.04 (#428)

Change base docker image from `node:x.x.x-buster-slim` to `ubuntu:18.04`
The image size reduces from 1.05GB to 327MB

- Install Node.js via nodesource https://github.com/nodesource/distributions
- Install Git via ppa:git-core/ppa https://git-scm.com/download/linux
This commit is contained in:
Shohei Ueda 2020-07-28 21:47:35 +09:00 committed by GitHub
parent a49e738c32
commit 70c0076457
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,32 +1,33 @@
ARG NODE_VERSION FROM ubuntu:18.04
FROM node:${NODE_VERSION}-buster-slim
SHELL ["/bin/bash", "-l", "-c"] SHELL ["/bin/bash", "-l", "-c"]
RUN apt-get update && \ RUN apt-get update && \
apt-get install -y --no-install-recommends software-properties-common gnupg && \
add-apt-repository ppa:git-core/ppa && \
apt-get update && \
apt-get install -y --no-install-recommends \ apt-get install -y --no-install-recommends \
build-essential \ git \
libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev autoconf \ curl \
ca-certificates \
wget \ wget \
ssh \ ssh \
vim && \ vim && \
apt-get autoclean && \ apt-get autoclean && \
apt-get clean && \ apt-get clean && \
apt-get autoremove -y && \ apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/* && \ rm -rf /var/lib/apt/lists/*
npm i -g npm
WORKDIR /git WORKDIR /node
ENV GIT_VERSION="2.28.0" ARG NODE_VERSION
RUN wget -q "https://github.com/git/git/archive/v${GIT_VERSION}.tar.gz" && \ RUN curl -o nodejs.deb "https://deb.nodesource.com/node_12.x/pool/main/n/nodejs/nodejs_${NODE_VERSION}-1nodesource1_amd64.deb" && \
tar -zxf "./v${GIT_VERSION}.tar.gz" && \ apt-get update && \
rm "./v${GIT_VERSION}.tar.gz" && \ apt-get install -y --no-install-recommends ./nodejs.deb && \
cd "./git-${GIT_VERSION}" && \ npm i -g npm && \
make configure && \ curl -sL https://deb.nodesource.com/test | bash - && \
./configure --prefix=/usr && \ rm -rf /var/lib/apt/lists/* && \
make all && \ rm -rf /node
make install
WORKDIR /repo
ENV LANG="C.UTF-8" ENV LANG="C.UTF-8"
ENV ImageVersion="20200625.0" ENV ImageVersion="20200625.0"
@ -36,8 +37,8 @@ ENV GITHUB_REPOSITORY_OWNER="peaceiris"
ENV GITHUB_ACTIONS="true" ENV GITHUB_ACTIONS="true"
ENV CI="true" ENV CI="true"
WORKDIR /repo RUN node -v && \
RUN rm -rf /git && \ npm -v && \
git --version && \ git --version && \
git config --global init.defaultBranch main && \ git config --global init.defaultBranch main && \
git config --global init.defaultBranch git config --global init.defaultBranch