Skip to content

Commit

Permalink
build: publish ghcr.io docker image (#137)
Browse files Browse the repository at this point in the history
Co-authored-by: dae-bot[bot] <136105375+dae-bot[bot]@users.noreply.github.com>
  • Loading branch information
kunish and dae-prow[bot] authored Jul 10, 2023
1 parent 9c297b3 commit 92dd638
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 19 deletions.
23 changes: 22 additions & 1 deletion .github/workflows/publish-docker-image.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: Publish Docker Image

on:
workflow_dispatch:
release:
types: [prereleased]

jobs:
publish-docker-image:
runs-on: ubuntu-latest
if: github.event_name == 'release'

steps:
- uses: actions/checkout@v3
Expand All @@ -19,6 +19,7 @@ jobs:

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
id: buildx

- name: Login to quay.io
uses: docker/login-action@v2
Expand All @@ -39,3 +40,23 @@ jobs:
quay.io/${{ github.repository }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Login to ghrc.io
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build ghcr.io image
uses: docker/build-push-action@v4
with:
context: .
builder: ${{ steps.buildx.outputs.name }}
file: Dockerfile
platforms: linux/amd64
push: true
tags: |
ghcr.io/${{ github.repository }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ RUN apt-get clean autoclean && apt-get autoremove -y && rm -rf /var/lib/{apt,dpk

FROM alpine

LABEL org.opencontainers.image.source=https://github.com/daeuniverse/daed

RUN mkdir -p /usr/local/share/daed/
RUN mkdir -p /etc/daed/
RUN wget -O /usr/local/share/daed/geoip.dat https://github.com/v2rayA/dist-v2ray-rules-dat/raw/master/geoip.dat
Expand Down
2 changes: 1 addition & 1 deletion src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export const HeaderWithActions = () => {
{!matchSmallScreen && (
<Tooltip label={endpointURL} withArrow>
<Code fz="xs" fw={700}>
{generalQuery?.general.dae.version || import.meta.env.__VERSION__}
{generalQuery?.general.dae.version}
</Code>
</Tooltip>
)}
Expand Down
8 changes: 0 additions & 8 deletions src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1 @@
/// <reference types="vite/client" />

interface ImportMetaEnv {
readonly __VERSION__: string
}

interface ImportMeta {
readonly env: ImportMetaEnv
}
11 changes: 2 additions & 9 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,16 @@ import path from 'path'

import react from '@vitejs/plugin-react-swc'
import { defineConfig } from 'vite'
import EnvironmentPlugin from 'vite-plugin-environment'

// eslint-disable-next-line import/no-default-export
export default defineConfig(async ({ mode }) => {
const { $ } = await import('execa')
const { stdout: hash } = await $`git rev-parse --short HEAD`

export default defineConfig(() => {
return {
base: './',
resolve: {
alias: {
'~': path.resolve('src'),
},
},
plugins: [
react(),
EnvironmentPlugin({ __VERSION__: mode === 'development' ? 'dev' : hash }, { defineOn: 'import.meta.env' }),
],
plugins: [react()],
}
})

0 comments on commit 92dd638

Please sign in to comment.