chore: packaging / docker / yarn, release ...

This commit is contained in:
lesion 2024-08-21 16:10:47 +02:00
parent 30c932a7f2
commit d2372eaa71
No known key found for this signature in database
GPG key ID: 352918250B012177
7 changed files with 352 additions and 636 deletions

View file

@ -3,6 +3,7 @@ node_modules
webcomponents webcomponents
yunohost yunohost
releases releases
!releases/latest.tgz
uploads uploads
_nuxt2 _nuxt2
wp_plugin wp_plugin

View file

@ -1,9 +1,6 @@
# prepare dependencies # prepare dependencies
FROM node:20-slim AS dependencies FROM node:20-slim AS dependencies
WORKDIR /home/node
## test with
# RUN apk add --update --no-cache vips-dev build-base vips
WORKDIR /app
RUN corepack enable RUN corepack enable
COPY package.json yarn.lock ./ COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile --production && \ RUN yarn install --frozen-lockfile --production && \
@ -17,22 +14,23 @@ RUN yarn install --frozen-lockfile --production && \
# RUN yarn test-sqlite # RUN yarn test-sqlite
## build ## build
FROM node:20-slim AS build # FROM node:20-slim AS build
WORKDIR /usr/src/app # WORKDIR /usr/src/app
COPY package.json yarn.lock ./ # COPY package.json yarn.lock ./
COPY --from=dependencies /app/node_modules ./node_modules # COPY --from=dependencies /app/node_modules ./node_modules
COPY . . # COPY . .
ENV NODE_ENV=production # ENV NODE_ENV=production
RUN yarn build --production # RUN yarn build --production
RUN yarn pack --filename /tmp/package.tgz # RUN yarn pack --filename /tmp/package.tgz
## production ## production
FROM node:20-slim FROM node:20-slim
RUN mkdir -p /app # RUN --mount=type=bind,from=build,source=/tmp/package.tgz,target=/tmp/package.tgz \
RUN --mount=type=bind,from=build,source=/tmp/package.tgz,target=/tmp/package.tgz \ # tar xf /tmp/package.tgz --owner node --group node -C /home/node --strip-components 1
tar xf /tmp/package.tgz -C /app --strip-components 1 ADD releases/latest.tgz /home/node/
COPY --from=dependencies /app/prod_node_modules /app/node_modules COPY --from=dependencies /home/node/prod_node_modules /home/node/package/node_modules
RUN ln -s /home/node/package/server/cli.js /usr/local/bin/gancio
EXPOSE 13120 EXPOSE 13120
ENTRYPOINT ["/app/server/cli.js"] ENTRYPOINT ["/home/node/package/server/cli.js"]

View file

@ -1,17 +0,0 @@
FROM node:18-slim AS nodejs-base
RUN apt-get -q update && \
env DEBIAN_FRONTEND=noninteractive apt-get -y install git && \
apt-get clean && rm -fr /var/lib/apt/lists/*
FROM nodejs-base AS build
RUN yarnpkg global add --network-timeout 1000000000 --latest --production --silent https://gancio.org/latest.tgz && \
apt-get clean && rm -fr /var/lib/apt/lists/* && \
yarnpkg cache clean
FROM nodejs-base
COPY --from=build /usr/local/share/.config/yarn/ /usr/local/share/.config/yarn/
RUN ln -s ../share/.config/yarn/global/node_modules/.bin/gancio /usr/local/bin/gancio
ENTRYPOINT ["/usr/local/bin/gancio"]

View file

@ -13,9 +13,9 @@ sudo apt install curl gcc g++ make wget libpq-dev
``` ```
1. Install Node.js & yarn 1. Install Node.js & yarn package manager
```bash ```bash
curl -sL https://deb.nodesource.com/setup_18.x | sudo bash - curl -sL https://deb.nodesource.com/setup_20.x | sudo bash -
sudo apt-get install -y nodejs sudo apt-get install -y nodejs
sudo npm install -g yarn sudo npm install -g yarn
``` ```
@ -53,6 +53,9 @@ sudo adduser --group --system --shell /bin/false --home /opt/gancio gancio
sudo yarn global add --network-timeout 1000000000 --silent {{site.url}}/latest.tgz sudo yarn global add --network-timeout 1000000000 --silent {{site.url}}/latest.tgz
``` ```
> Note "Use yarn"
> Only `yarn` is supported as package manager
> info "Install another release" > info "Install another release"
> You can found old releases at [{{site.url}}/releases]({{site.url}}/releases) > You can found old releases at [{{site.url}}/releases]({{site.url}}/releases)

View file

@ -140,5 +140,6 @@
"type": "git", "type": "git",
"url": "https://framagit.org/les/gancio" "url": "https://framagit.org/les/gancio"
}, },
"snyk": true "snyk": true,
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
} }

View file

@ -1,17 +1,19 @@
RELEASE=v$(cat package.json | jq ".version" | sed -e 's/"//g') RELEASE=v$(cat package.json | jq ".version" | sed -e 's/"//g')
echo "Releasing $RELEASE" echo "Releasing $RELEASE"
rm -fr node_modules rm -fr node_modules
yarn yarn --frozen-lockfile
yarn build yarn --frozen-lockfile build
yarn pack yarn --frozen-lockfile pack
yarn publish
gpg --pinentry-mode loopback --passphrase `pass underscore/pgp` --detach-sign --local-user 5DAC477D5441B7A15ACBF680BBEB4DD39AC6CCA9 gancio-$RELEASE.tgz gpg --pinentry-mode loopback --passphrase `pass underscore/pgp` --detach-sign --local-user 5DAC477D5441B7A15ACBF680BBEB4DD39AC6CCA9 gancio-$RELEASE.tgz
cp gancio-$RELEASE.tgz releases/ cp gancio-$RELEASE.tgz releases/
mv gancio-$RELEASE.tgz releases/latest.tgz mv gancio-$RELEASE.tgz releases/latest.tgz
cp gancio-$RELEASE.tgz.sig releases/ cp gancio-$RELEASE.tgz.sig releases/
mv gancio-$RELEASE.tgz.sig releases/latest.tgz.sig mv gancio-$RELEASE.tgz.sig releases/latest.tgz.sig
docker build . -t cisti/gancio
yarn doc yarn doc
rsync -a docs/_site/ --chown=www-data:www-data cisti.web:/var/www/gancio/ rsync -a docs/_site/ --chown=www-data:www-data cisti.web:/var/www/gancio/
git tag $RELEASE # git tag $RELEASE
git push --tags # git push --tags
cd docs # cd docs

912
yarn.lock

File diff suppressed because it is too large Load diff