From 70c0076457b26d38a26bacbac279b8bf35cc47c8 Mon Sep 17 00:00:00 2001 From: Shohei Ueda <30958501+peaceiris@users.noreply.github.com> Date: Tue, 28 Jul 2020 21:47:35 +0900 Subject: [PATCH] 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 --- Dockerfile | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/Dockerfile b/Dockerfile index fccf298..653da92 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,32 +1,33 @@ -ARG NODE_VERSION -FROM node:${NODE_VERSION}-buster-slim +FROM ubuntu:18.04 SHELL ["/bin/bash", "-l", "-c"] 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 \ - build-essential \ - libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev autoconf \ - ca-certificates \ + git \ + curl \ wget \ ssh \ vim && \ apt-get autoclean && \ apt-get clean && \ apt-get autoremove -y && \ + rm -rf /var/lib/apt/lists/* + +WORKDIR /node +ARG NODE_VERSION +RUN curl -o nodejs.deb "https://deb.nodesource.com/node_12.x/pool/main/n/nodejs/nodejs_${NODE_VERSION}-1nodesource1_amd64.deb" && \ + apt-get update && \ + apt-get install -y --no-install-recommends ./nodejs.deb && \ + npm i -g npm && \ + curl -sL https://deb.nodesource.com/test | bash - && \ rm -rf /var/lib/apt/lists/* && \ - npm i -g npm + rm -rf /node -WORKDIR /git -ENV GIT_VERSION="2.28.0" -RUN wget -q "https://github.com/git/git/archive/v${GIT_VERSION}.tar.gz" && \ - tar -zxf "./v${GIT_VERSION}.tar.gz" && \ - rm "./v${GIT_VERSION}.tar.gz" && \ - cd "./git-${GIT_VERSION}" && \ - make configure && \ - ./configure --prefix=/usr && \ - make all && \ - make install +WORKDIR /repo ENV LANG="C.UTF-8" ENV ImageVersion="20200625.0" @@ -36,8 +37,8 @@ ENV GITHUB_REPOSITORY_OWNER="peaceiris" ENV GITHUB_ACTIONS="true" ENV CI="true" -WORKDIR /repo -RUN rm -rf /git && \ +RUN node -v && \ + npm -v && \ git --version && \ git config --global init.defaultBranch main && \ git config --global init.defaultBranch