Прокидывание версии

This commit is contained in:
Александр Кирюхин 2024-01-21 17:49:35 +03:00
parent d76d0e865d
commit e47115036e
6 changed files with 21 additions and 15 deletions

View file

@ -1,11 +1,12 @@
steps: steps:
build: build:
image: plugins/docker image: woodpeckerci/plugin-docker-buildx
settings: settings:
registry: gitrepo.ru registry: gitrepo.ru
username: neonxp username: neonxp
password: password:
from_secret: gitea_token from_secret: gitea_token
repo: gitrepo.ru/neonxp/nquest repo: gitrepo.ru/neonxp/nquest
tags: latest tags:
auto_tag: true - latest
- ${CI_COMMIT_SHA}

View file

@ -1,19 +1,21 @@
# Build frontend # Build frontend
FROM node:21-alpine3.17 as frontend FROM node:21-alpine3.17 as frontend
ARG VERSION
WORKDIR /app WORKDIR /app
COPY ./frontend /app COPY ./frontend /app
RUN echo "@neonxp:registry=https://gitrepo.ru/api/packages/neonxp/npm/" > ~/.npmrc RUN echo "@neonxp:registry=https://gitrepo.ru/api/packages/neonxp/npm/" > ~/.npmrc
RUN npm install && npm run build RUN npm install && VITE_VERSION=${VERSION} npm run build
# Build backend # Build backend
FROM golang:1.21.3-alpine3.17 as backend FROM golang:1.21.3-alpine3.17 as backend
ARG VERSION
WORKDIR /app WORKDIR /app
RUN apk update --no-cache && apk add --no-cache tzdata RUN apk update --no-cache && apk add --no-cache tzdata
COPY go.mod go.sum ./ COPY go.mod go.sum ./
RUN go mod download && go mod verify RUN go mod download && go mod verify
COPY . . COPY . .
COPY --from=frontend /app/dist /app/frontend/dist COPY --from=frontend /app/dist /app/frontend/dist
RUN go build -o nquest *.go RUN go build -ldflags="-X gitrepo.ru/neonxp/nquest.Version=${VERSION}" -o nquest *.go
# Runtime container # Runtime container
FROM alpine:3.17 FROM alpine:3.17
@ -25,14 +27,6 @@ COPY --from=backend /app/nquest /app/nquest
ENV TZ Europe/Moscow ENV TZ Europe/Moscow
ENV PG_HOST nquestdb
ENV PG_NAME nquest
ENV PG_USER nquest
ENV PG_PASS nquest
ENV PG_PORT 5432
ENV SECRET s3cr3t
ENV LISTEN :8000
EXPOSE 8000 EXPOSE 8000
CMD ["/app/nquest"] CMD ["/app/nquest"]

View file

@ -9,6 +9,8 @@ import App from './App.jsx'
import { store } from './store/provider.js' import { store } from './store/provider.js'
const { darkAlgorithm } = theme const { darkAlgorithm } = theme
console.log(import.meta.env.VITE_VERSION)
ReactDOM.createRoot(document.getElementById('root')).render( ReactDOM.createRoot(document.getElementById('root')).render(
<React.StrictMode> <React.StrictMode>
<Compose providers={store}> <Compose providers={store}>

View file

@ -0,0 +1,5 @@
const Quest = () => {
}
export default Quest

View file

@ -61,7 +61,7 @@ const manifest = {
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig({ export default defineConfig({
plugins: [react(), splitVendorChunkPlugin(), VitePWA(manifest)], plugins: [react(), splitVendorChunkPlugin()/* , VitePWA(manifest) */],
server: { server: {
proxy: { proxy: {
'/api': { '/api': {

View file

@ -25,6 +25,10 @@ import (
"gitrepo.ru/neonxp/nquest/pkg/service" "gitrepo.ru/neonxp/nquest/pkg/service"
) )
var (
Version = "dev"
)
func main() { func main() {
cfg, err := GetConfig() cfg, err := GetConfig()
if err != nil { if err != nil {
@ -177,7 +181,7 @@ func main() {
// --[ System ]-- // --[ System ]--
e.GET("/metrics", echoprometheus.NewHandler()) e.GET("/metrics", echoprometheus.NewHandler())
e.Logger.Debugf("backend version %s", Version)
e.Logger.Fatal(e.Start(cfg.Listen)) e.Logger.Fatal(e.Start(cfg.Listen))
} }