chore: github ci build

This commit is contained in:
Taranto 2023-06-20 08:42:49 +01:00
parent 13bf3eb5b4
commit 20af833f1c
4 changed files with 70 additions and 0 deletions

39
build/Dockerfile.ci Normal file
View file

@ -0,0 +1,39 @@
FROM ubuntu:20.04 as base
ARG VERSION
ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Lisbon
RUN apt-get update
RUN apt-get install -y -q curl \
sudo \
git \
python2-minimal \
build-essential \
libpq-dev \
net-tools \
tar
RUN curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
RUN apt-get install nodejs -y -q
FROM base as l-s-build
WORKDIR lamassu-server
# # Prevent cache invalidation when we only change version numbers
COPY ["package.json", "package-lock.json", "./"]
RUN npm version --allow-same-version --git-tag-version false --commit-hooks false 1.0.0
RUN npm install --production
COPY . ./
RUN rm -rf public/*
RUN cd new-lamassu-admin && npm install && npm run build
RUN cp -r new-lamassu-admin/build/* public
RUN rm -rf new-lamassu-admin/node_modules
RUN cd .. && tar -zcvf lamassu-server.tar.gz ./lamassu-server
ENTRYPOINT [ "/bin/bash" ]

8
build/ci-build.sh Normal file
View file

@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -e
docker build -t build:latest -f build-scripts/Dockerfile.ci build-scripts/Dockerfile.ci .
id=$(docker create build)
docker cp $id:/lamassu-server.tar.gz ./lamassu-server.tar.gz
docker rm -v $id