build: use pnpm for the deploy

This commit is contained in:
Rafael Taranto 2025-05-23 16:02:58 +01:00
parent 64e358f61c
commit bac8813a8d
36 changed files with 19068 additions and 29560 deletions

View file

@ -1,41 +0,0 @@
FROM node:22-alpine AS build-ui
RUN apk add --no-cache npm git curl build-base python3
COPY ["packages/admin-ui/package.json", "package-lock.json", "./"]
RUN npm version --allow-same-version --git-tag-version false --commit-hooks false 1.0.0
RUN npm install
COPY packages/admin-ui/ ./
RUN npm run build
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_22.x | sudo -E bash -
RUN apt-get install nodejs -y -q
WORKDIR lamassu-server
COPY ["packages/server/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 ./packages/server/ ./
COPY --from=build-ui /build /lamassu-server/public
RUN cd .. && tar -zcvf lamassu-server.tar.gz ./lamassu-server

55
build/docker-compose.yaml Normal file
View file

@ -0,0 +1,55 @@
version: "3.8"
services:
lamassu-server:
image: lamassu/lamassu-server:latest
restart: on-failure
network_mode: host
volumes:
- ./lamassu-data:/lamassu-data
environment:
- NODE_ENV=production
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres123
- POSTGRES_HOST=localhost
- POSTGRES_PORT=5432
- POSTGRES_DB=lamassu
- CA_PATH=/lamassu-data/certs/Lamassu_OP_Root_CA.pem
- CERT_PATH=/lamassu-data/certs/Lamassu_OP.pem
- KEY_PATH=/lamassu-data/private/Lamassu_OP.key
- MNEMONIC_PATH=/lamassu-data/mnemonics/mnemonic.txt
- OFAC_DATA_DIR=/lamassu-data/ofac
- ID_PHOTO_CARD_DIR=/lamassu-data/idphotocard
- FRONT_CAMERA_DIR=/lamassu-data/frontcamera
- OPERATOR_DATA_DIR=/lamassu-data/operatordata
- COIN_ATM_RADAR_URL=https://coinatmradar.info/api/lamassu/
- HOSTNAME=localhost
- LOG_LEVEL=info
lamassu-admin-server:
image: lamassu/lamassu-admin-server:latest
restart: on-failure
network_mode: host
volumes:
- ./lamassu-data:/lamassu-data
environment:
- NODE_ENV=production
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres123
- POSTGRES_HOST=localhost
- POSTGRES_PORT=5432
- POSTGRES_DB=lamassu
- CA_PATH=/lamassu-data/certs/Lamassu_OP_Root_CA.pem
- CERT_PATH=/lamassu-data/certs/Lamassu_OP.pem
- KEY_PATH=/lamassu-data/private/Lamassu_OP.key
- MNEMONIC_PATH=/lamassu-data/mnemonics/mnemonic.txt
- OFAC_DATA_DIR=/lamassu-data/ofac
- ID_PHOTO_CARD_DIR=/lamassu-data/idphotocard
- FRONT_CAMERA_DIR=/lamassu-data/frontcamera
- OPERATOR_DATA_DIR=/lamassu-data/operatordata
- COIN_ATM_RADAR_URL=https://coinatmradar.info/api/lamassu/
- HOSTNAME=172.29.0.3
- LOG_LEVEL=info
depends_on:
lamassu-server:
condition: service_started

View file

@ -1,49 +1,20 @@
FROM node:22-alpine AS build
RUN apk add --no-cache npm git curl build-base net-tools python3 postgresql-dev
FROM node:22-alpine AS base
RUN apk add --no-cache bash libpq openssl ca-certificates
WORKDIR /lamassu-server
COPY ["packages/server/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 the pre-built production package from CI (with node_modules)
COPY lamassu-server/ ./
COPY packages/server/ ./
FROM node:22-alpine AS l-s-base
RUN apk add --no-cache npm git curl bash libpq openssl ca-certificates
COPY --from=build /lamassu-server /lamassu-server
FROM l-s-base AS l-s
# Install production dependencies in the container
RUN npm install --omit=dev --ignore-scripts
FROM base AS l-s
RUN chmod +x /lamassu-server/bin/lamassu-server-entrypoint.sh
EXPOSE 3000
ENTRYPOINT [ "/lamassu-server/bin/lamassu-server-entrypoint.sh" ]
FROM node:22-alpine AS build-ui
RUN apk add --no-cache npm git curl build-base python3
WORKDIR /app
COPY ["packages/admin-ui/package.json", "package-lock.json", "./"]
RUN npm version --allow-same-version --git-tag-version false --commit-hooks false 1.0.0
RUN npm install
COPY packages/admin-ui/ ./
RUN npm run build
FROM l-s-base AS l-a-s
COPY --from=build-ui /app/build /lamassu-server/public
FROM base AS l-a-s
RUN chmod +x /lamassu-server/bin/lamassu-admin-server-entrypoint.sh
EXPOSE 443
ENTRYPOINT [ "/lamassu-server/bin/lamassu-admin-server-entrypoint.sh" ]