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

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:
build:
image: plugins/docker
image: woodpeckerci/plugin-docker-buildx
settings:
registry: gitrepo.ru
username: neonxp
password:
from_secret: gitea_token
repo: gitrepo.ru/neonxp/nquest
tags: latest
auto_tag: true
tags:
- latest
- ${CI_COMMIT_SHA}

View file

@ -1,19 +1,21 @@
# Build frontend
FROM node:21-alpine3.17 as frontend
ARG VERSION
WORKDIR /app
COPY ./frontend /app
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
FROM golang:1.21.3-alpine3.17 as backend
ARG VERSION
WORKDIR /app
RUN apk update --no-cache && apk add --no-cache tzdata
COPY go.mod go.sum ./
RUN go mod download && go mod verify
COPY . .
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
FROM alpine:3.17
@ -25,14 +27,6 @@ COPY --from=backend /app/nquest /app/nquest
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
CMD ["/app/nquest"]

View file

@ -9,6 +9,8 @@ import App from './App.jsx'
import { store } from './store/provider.js'
const { darkAlgorithm } = theme
console.log(import.meta.env.VITE_VERSION)
ReactDOM.createRoot(document.getElementById('root')).render(
<React.StrictMode>
<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/
export default defineConfig({
plugins: [react(), splitVendorChunkPlugin(), VitePWA(manifest)],
plugins: [react(), splitVendorChunkPlugin()/* , VitePWA(manifest) */],
server: {
proxy: {
'/api': {

View file

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