build(): test new build sys

This commit is contained in:
Aleksander Wilczyński 2025-04-27 15:24:09 +02:00
parent 94903146c4
commit b41a0a9127
Signed by: alekswilc
GPG Key ID: D4464A248E5F27FE
6 changed files with 25 additions and 26 deletions

View File

@ -6,14 +6,23 @@ name: build
steps: steps:
- name: build-backend - name: build-backend
image: plugins/docker image: plugins/docker
environment:
TAG:
${DRONE_TAG}
COMMIT:
${DRONE_COMMIT}
settings: settings:
insecure: true insecure: true
repo: 10.5.0.103:1222/simrail-backend repo: 10.5.0.103:1222/simrail-backend
registry: 10.5.0.103:1222 registry: 10.5.0.103:1222
context: './packages/backend' context: './packages/backend'
dockerfile: './packages/backend/Dockerfile' dockerfile: './packages/backend/Dockerfile'
build_args_from_env:
- TAG
- COMMIT
tags: tags:
- latest - latest
- ${DRONE_TAG}
- name: build-frontend - name: build-frontend
image: plugins/docker image: plugins/docker
@ -33,7 +42,7 @@ steps:
- VITE_STATS_KEY - VITE_STATS_KEY
tags: tags:
- latest - latest
- ${DRONE_TAG##v}
trigger: trigger:
branch: - tag
- main

View File

@ -6,8 +6,13 @@ COPY . .
RUN yarn add -D typescript RUN yarn add -D typescript
RUN yarn rawbuild RUN yarn rawbuild
RUN ls ARG COMMIT
ENV COMMIT $COMMIT
ARG TAG
ENV TAG $TAG
RUN yarn make-git-info
# Install Doppler CLI # Install Doppler CLI
RUN wget -q -t3 'https://packages.doppler.com/public/cli/rsa.8004D9FF50437357.key' -O /etc/apk/keys/cli@doppler-8004D9FF50437357.rsa.pub && \ RUN wget -q -t3 'https://packages.doppler.com/public/cli/rsa.8004D9FF50437357.key' -O /etc/apk/keys/cli@doppler-8004D9FF50437357.rsa.pub && \

View File

@ -6,7 +6,8 @@
"scripts": { "scripts": {
"build": "docker build --progress=plain -t simrailpro:backend .", "build": "docker build --progress=plain -t simrailpro:backend .",
"rawbuild": "yarn tsc", "rawbuild": "yarn tsc",
"start": "yarn rawbuild && node --env-file=.env dist/index.js" "start": "yarn rawbuild && node --env-file=.env dist/index.js",
"make-git-info": "node scripts/make-git.js"
}, },
"author": "Aleksander <alekswilc> Wilczyński", "author": "Aleksander <alekswilc> Wilczyński",
"license": "AGPL-3.0-only", "license": "AGPL-3.0-only",

View File

@ -14,7 +14,7 @@
* See LICENSE for more. * See LICENSE for more.
*/ */
import { execSync } from "child_process"; import gitInfo from '../../git.json' with { type: "json" };
export class GitUtil export class GitUtil
{ {
@ -22,28 +22,12 @@ export class GitUtil
private static getLatestVersion() private static getLatestVersion()
{ {
return process.env.CURRENT_VERSION; return gitInfo.tag;
// try
// {
// const data = execSync("git describe --tags --exact-match").toString();
// return data.replace("\n", "");
// } catch
// {
// return undefined;
// }
} }
private static getLatestCommit() private static getLatestCommit()
{ {
return process.env.CURRENT_COMMIT; return gitInfo.commit;
// try
// {
// const data = execSync("git rev-parse --short HEAD").toString();
// return data.replace("\n", "");
// } catch
// {
// return undefined;
// }
} }

View File

@ -39,7 +39,7 @@
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
// "resolveJsonModule": true, /* Enable importing .json files. */ "resolveJsonModule": true, /* Enable importing .json files. */
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */ // "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */

View File

@ -169,7 +169,7 @@ export const ProfileCard = ({ data, images }: { data: TProfileData, images: TIma
{dispatcherStats[dispatcherPage - 1].map(stationName => { {dispatcherStats[dispatcherPage - 1].map(stationName => {
const station = data.player.dispatcherStats[stationName]; const station = data.player.dispatcherStats[stationName];
return <StationStat stationName={stationName} time={station.time} image={images.stations[stationName]} /> return <StationStat stationName={stationName} time={station.time} image={images.stations[stationName] ?? images.stations['N/A']} />
})} })}
</div> </div>
<div className="flex flex-col pt-4"> <div className="flex flex-col pt-4">
@ -194,7 +194,7 @@ export const ProfileCard = ({ data, images }: { data: TProfileData, images: TIma
<div className="grid grid-cols-1 gap-7.5 sm:grid-cols-3 xl:grid-cols-4 pt-4"> <div className="grid grid-cols-1 gap-7.5 sm:grid-cols-3 xl:grid-cols-4 pt-4">
{trainStats[trainPage - 1].map(trainName => { {trainStats[trainPage - 1].map(trainName => {
const train = data.player.trainStats[trainName]; const train = data.player.trainStats[trainName];
return <TrainStat trainName={trainName} time={train.time} distance={train.distance} score={train.score} image={images.trains[trainName]} /> return <TrainStat trainName={trainName} time={train.time} distance={train.distance} score={train.score} image={images.trains[trainName] ?? images.trains['N/A']} />
})} })}
</div> </div>
<div className="flex flex-col pt-4"> <div className="flex flex-col pt-4">