Use global gitlab variable versions

This commit is contained in:
Florian Hoss 2024-03-13 11:51:52 +01:00
parent e9409a153d
commit fcd007d7be
3 changed files with 23 additions and 23 deletions

View file

@ -6,7 +6,7 @@ variables:
LATEST_IMAGE: '$CI_REGISTRY_IMAGE:latest' LATEST_IMAGE: '$CI_REGISTRY_IMAGE:latest'
PRODUCTION_URL: 'https://home.unjx.de' PRODUCTION_URL: 'https://home.unjx.de'
image: docker:$DOCKER_VERSION-git image: docker:$V_DOCKER-git
.auth_gitlab: .auth_gitlab:
before_script: before_script:
@ -37,7 +37,7 @@ build:
deploy: deploy:
rules: !reference [.rules:deploy, rules] rules: !reference [.rules:deploy, rules]
stage: deploy stage: deploy
image: debian:${DEBIAN_VERSION}-slim image: debian:${V_DEBIAN}-slim
id_tokens: id_tokens:
TBOT_GITLAB_JWT: TBOT_GITLAB_JWT:
aud: tp.unjx.de aud: tp.unjx.de
@ -45,8 +45,8 @@ deploy:
- apt-get update && apt-get install curl -y - apt-get update && apt-get install curl -y
- cp tbot.yaml /tmp - cp tbot.yaml /tmp
- cd /tmp - cd /tmp
- 'curl -O https://cdn.teleport.dev/teleport-v${TELEPORT_VERSION}-linux-amd64-bin.tar.gz' - 'curl -O https://cdn.teleport.dev/teleport-v${V_TELEPORT}-linux-amd64-bin.tar.gz'
- tar -xvf teleport-v${TELEPORT_VERSION}-linux-amd64-bin.tar.gz - tar -xvf teleport-v${V_TELEPORT}-linux-amd64-bin.tar.gz
- ./teleport/install - ./teleport/install
- 'tbot start -c tbot.yaml' - 'tbot start -c tbot.yaml'
- 'tsh -i /tmp/machine-id/identity --proxy tp.unjx.de:443 ssh gitlab@berg "docker compose -f /opt/docker/home/compose.yml up home -d --pull always && docker system prune --force"' - 'tsh -i /tmp/machine-id/identity --proxy tp.unjx.de:443 ssh gitlab@berg "docker compose -f /opt/docker/home/compose.yml up home -d --pull always && docker system prune --force"'

View file

@ -1,7 +1,7 @@
ARG GOLANG_VERSION ARG V_GOLANG
ARG NODE_VERSION ARG V_NODE
ARG ALPINE_VERSION ARG V_ALPINE
FROM golang:${GOLANG_VERSION}-alpine AS goBuilder FROM golang:${V_GOLANG}-alpine AS goBuilder
WORKDIR /app WORKDIR /app
RUN go install github.com/a-h/templ/cmd/templ@latest RUN go install github.com/a-h/templ/cmd/templ@latest
@ -14,7 +14,7 @@ COPY . .
RUN templ generate RUN templ generate
RUN go build -ldflags="-s -w" -o godash main.go RUN go build -ldflags="-s -w" -o godash main.go
FROM node:${NODE_VERSION}-alpine AS nodeBuilder FROM node:${V_NODE}-alpine AS nodeBuilder
WORKDIR /app WORKDIR /app
COPY package.json yarn.lock ./ COPY package.json yarn.lock ./
@ -26,12 +26,12 @@ COPY views ./views
COPY tailwind.config.js . COPY tailwind.config.js .
RUN yarn run tw:build RUN yarn run tw:build
FROM alpine:${ALPINE_VERSION} AS logo FROM alpine:${V_ALPINE} AS logo
WORKDIR /app WORKDIR /app
RUN apk add figlet RUN apk add figlet
RUN figlet GoDash > logo.txt RUN figlet GoDash > logo.txt
FROM alpine:${ALPINE_VERSION} AS final FROM alpine:${V_ALPINE} AS final
WORKDIR /app WORKDIR /app
RUN apk add tzdata RUN apk add tzdata

View file

@ -6,17 +6,17 @@ services:
context: . context: .
dockerfile: Dockerfile dockerfile: Dockerfile
args: args:
- GOLANG_VERSION=${GOLANG_VERSION} - V_GOLANG=${V_GOLANG}
- NODE_VERSION=${NODE_VERSION} - V_NODE=${V_NODE}
- ALPINE_VERSION=${ALPINE_VERSION} - V_ALPINE=${V_ALPINE}
- APP_VERSION=${CI_COMMIT_TAG} - APP_VERSION=${CI_COMMIT_TAG}
backend: backend:
build: build:
context: . context: .
dockerfile_inline: | dockerfile_inline: |
ARG GOLANG_VERSION ARG V_GOLANG
FROM golang:${GOLANG_VERSION}-alpine FROM golang:${V_GOLANG}-alpine
RUN apk update && \ RUN apk update && \
apk upgrade && \ apk upgrade && \
apk add tzdata apk add tzdata
@ -29,7 +29,7 @@ services:
COPY go.sum . COPY go.sum .
RUN go mod download RUN go mod download
args: args:
- GOLANG_VERSION=${GOLANG_VERSION} - V_GOLANG=${V_GOLANG}
command: air -c .air.toml command: air -c .air.toml
environment: environment:
- TZ=Europe/Berlin - TZ=Europe/Berlin
@ -46,19 +46,19 @@ services:
build: build:
context: . context: .
dockerfile_inline: | dockerfile_inline: |
ARG GOLANG_VERSION ARG V_GOLANG
FROM golang:${GOLANG_VERSION}-alpine FROM golang:${V_GOLANG}-alpine
RUN go install github.com/a-h/templ/cmd/templ@latest RUN go install github.com/a-h/templ/cmd/templ@latest
args: args:
- GOLANG_VERSION=${GOLANG_VERSION} - V_GOLANG=${V_GOLANG}
working_dir: /app working_dir: /app
command: templ generate --watch command: templ generate --watch
volumes: volumes:
- .:/app/ - .:/app/
tailwind: tailwind:
image: node:${NODE_VERSION}-alpine image: node:${V_NODE}-alpine
working_dir: /app working_dir: /app
command: yarn tw:dev command: yarn tw:dev
tty: true tty: true
@ -67,14 +67,14 @@ services:
golang: golang:
profiles: [install] profiles: [install]
image: golang:${GOLANG_VERSION}-alpine image: golang:${V_GOLANG}-alpine
working_dir: /app working_dir: /app
volumes: volumes:
- .:/app/ - .:/app/
node: node:
profiles: [install] profiles: [install]
image: node:${NODE_VERSION}-alpine image: node:${V_NODE}-alpine
working_dir: /app working_dir: /app
volumes: volumes:
- .:/app/ - .:/app/