Skip to content

Commit

Permalink
fix: forward build info in docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
simonwep committed Nov 13, 2023
1 parent 9ecec91 commit e5cd106
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Set outputs
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
Expand All @@ -83,3 +87,5 @@ jobs:
platforms: linux/amd64,linux/arm64
build-args: |
OCULAR_GENESIS_HOST=${{ env.OCULAR_GENESIS_HOST }}
OCULAR_BUILD_VERSION=${{ github.ref_name }}
OCULAR_BUILD_SHA=${{ steps.vars.outputs.sha_short }}
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
FROM --platform=$BUILDPLATFORM node:20-alpine AS build

ARG OCULAR_GENESIS_HOST
ARG OCULAR_BUILD_VERSION
ARG OCULAR_BUILD_SHA

ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"

ENV OCULAR_BUILD_VERSION=${OCULAR_BUILD_VERSION}
ENV OCULAR_BUILD_SHA=${OCULAR_BUILD_SHA}

RUN npx pnpm install --global pnpm@8
WORKDIR /app

Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/navigation/info/InfoDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const { t } = useI18n();
display: flex;
flex-direction: column;
font-size: var(--font-size-s);
text-align: center;
gap: 2px;
}
Expand All @@ -51,7 +52,6 @@ const { t } = useI18n();
font-size: var(--font-size-xs);
font-weight: var(--font-weight-l);
margin-top: 8px;
text-align: center;
}
.meta {
Expand Down
4 changes: 2 additions & 2 deletions src/types/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ interface ImportMetaEnv {

// Build information
readonly OCULAR_BUILD_TIMESTAMP: number;
readonly OCULAR_BUILD_SHA: string;
readonly OCULAR_BUILD_VERSION: string;
readonly OCULAR_BUILD_VERSION?: string;
readonly OCULAR_BUILD_SHA?: string;
}

interface ImportMeta {
Expand Down
6 changes: 1 addition & 5 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@ export default defineConfig({
}
},
define: {
'import.meta.env.OCULAR_BUILD_TIMESTAMP': Date.now(),
'import.meta.env.OCULAR_BUILD_SHA': JSON.stringify(execSync('git rev-parse --short HEAD').toString().trim()),
'import.meta.env.OCULAR_BUILD_VERSION': JSON.stringify(
execSync('git describe --tags --always --abbrev=0').toString().trim()
)
'import.meta.env.OCULAR_BUILD_TIMESTAMP': Date.now()
},
plugins: [
tsconfigPaths({ loose: true }),
Expand Down

0 comments on commit e5cd106

Please sign in to comment.