From 6b176c22dcdb4eb449d78809f3a0b66f3b315920 Mon Sep 17 00:00:00 2001 From: tanshu Date: Sun, 31 Oct 2021 18:47:25 +0530 Subject: [PATCH] Docker: Change the dockerfile to better use caching. --- deploy.sh | 11 +++++++++++ docker/app/Dockerfile | 22 +++++++++++++++++++--- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/deploy.sh b/deploy.sh index 1a6f0119..dde65389 100755 --- a/deploy.sh +++ b/deploy.sh @@ -13,6 +13,17 @@ else ./version_bump.sh fi +# Download the package.json for caching +curl --silent 'https://git.tanshu.com/tanshu/brewman/raw/tag/latest/overlord/package.json' \ + | sed 's/\"version\": \"[0-9\.]*\"/"version": "0.0.0"/g' \ + > "$parent_path/docker/app/package.json" + +# Download the package.json for caching +curl --silent 'https://git.tanshu.com/tanshu/brewman/raw/tag/latest/brewman/pyproject.toml' \ + | sed 's/version = \"[0-9\.]*\"/version = "0.0.0"/g' \ + > "$parent_path/docker/app/pyproject.toml" + + cd "$parent_path/docker/app" || exit docker build --tag brewman:latest . cd "$parent_path/docker" || exit diff --git a/docker/app/Dockerfile b/docker/app/Dockerfile index 7604eeac..71b30b4b 100644 --- a/docker/app/Dockerfile +++ b/docker/app/Dockerfile @@ -1,14 +1,30 @@ FROM node:latest AS builder +RUN mkdir -p /app/overlord +COPY package.json /app/overlord/package.json +RUN cd /app/overlord \ + && npm install --unsafe-perm \ + && mv /app/overlord/node_modules / \ + && cd / \ + && rm -rf /app ADD https://git.tanshu.com/api/v1/repos/tanshu/brewman/tags /tags.json RUN git clone --single-branch --depth 1 --branch latest https://git.tanshu.com/tanshu/brewman.git /app WORKDIR /app/overlord -RUN npm install --unsafe-perm && /app/overlord/node_modules/.bin/ng build +RUN mv /node_modules /app/overlord/ \ + && /app/overlord/node_modules/.bin/ng build -FROM python:latest +FROM python:3.9 LABEL maintainer="Amritanshu " -ADD https://git.tanshu.com/tanshu/brewman/raw/tag/latest/brewman/pyproject.toml /app/pyproject.toml +COPY pyproject.toml /app/pyproject.toml + +RUN apt-get update && \ + apt-get install -y locales && \ + sed --in-place --expression='s/# en_IN UTF-8/en_IN UTF-8/' /etc/locale.gen && \ + dpkg-reconfigure --frontend=noninteractive locales + +ENV LANG en_IN +ENV LC_ALL en_IN # Install Poetry RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | POETRY_HOME=/opt/poetry python && \