mirror of
https://github.com/sharevb/it-tools.git
synced 2026-12-01 01:14:13 +03:00
feat(Docker): publish an latest-en (english only docker image)
Related to #330
This commit is contained in:
1 parent
2c9db240e4
commit
832ff9043b
4 files changed
+39
-11
No files matched your search
@@ -41,6 +41,9 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- ci
|
||||
strategy:
|
||||
matrix:
|
||||
language: ['', 'en']
|
||||
steps:
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
@@ -48,7 +51,7 @@ jobs:
|
||||
with:
|
||||
images: sharevb/it-tools
|
||||
labels: |
|
||||
org.opencontainers.image.version=latest
|
||||
org.opencontainers.image.version=${{ case(matrix.language != '', format('latest-{0}', matrix.language), 'latest') }}
|
||||
|
||||
# Checkout the repository
|
||||
- name: Checkout repository
|
||||
@@ -80,12 +83,14 @@ jobs:
|
||||
file: ./Dockerfile
|
||||
build-args: |
|
||||
"BASE_URL=/"
|
||||
"VITE_AVAILABLE_LOCALES=${{ matrix.language }}"
|
||||
"VITE_LANGUAGE=${{ matrix.language }}"
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
tags: |
|
||||
sharevb/it-tools:latest
|
||||
ghcr.io/${{ github.repository_owner }}/it-tools:latest
|
||||
sharevb/it-tools:${{ case(matrix.language != '', format('latest-{0}', matrix.language), 'latest') }}
|
||||
ghcr.io/sharevb/it-tools:${{ case(matrix.language != '', format('latest-{0}', matrix.language), 'latest') }}
|
||||
|
||||
# Optionally log out
|
||||
- name: Log out from GitHub Container Registry
|
||||
|
||||
@@ -13,6 +13,8 @@ RUN npm install -g pnpm && pnpm i --ignore-scripts --frozen-lockfile
|
||||
COPY . .
|
||||
ARG BASE_URL
|
||||
ENV BASE_URL=${BASE_URL}
|
||||
ARG VITE_AVAILABLE_LOCALES
|
||||
ENV VITE_AVAILABLE_LOCALES=${VITE_AVAILABLE_LOCALES}
|
||||
ENV VITE_VERCEL_ENV=production
|
||||
RUN pnpm build
|
||||
|
||||
|
||||
@@ -58,6 +58,12 @@ Use of WSL2 is recommended to develop using VSCode on Windows. Direct developmen
|
||||
|
||||
[Docker Hub](https://hub.docker.com/r/sharevb/it-tools): `sharevb/it-tools:latest`
|
||||
|
||||
```bash
|
||||
docker run --pull always --restart unless-stopped -p 8080:8080 sharevb/it-tools:latest
|
||||
```
|
||||
|
||||
Other existing docker tags: `latest-en` (english only)
|
||||
|
||||
## Use in Docker Compose file
|
||||
|
||||
```yml
|
||||
|
||||
+23
-8
@@ -21,6 +21,28 @@ import VueI18n from '@intlify/unplugin-vue-i18n/vite';
|
||||
|
||||
const baseUrl = process.env.BASE_URL || '/';
|
||||
|
||||
const VITE_AVAILABLE_LOCALES = process.env.VITE_AVAILABLE_LOCALES;
|
||||
console.log(`Building for locales: ${VITE_AVAILABLE_LOCALES}`);
|
||||
|
||||
let includeLocales = [
|
||||
resolve(__dirname, 'locales/en.yml'),
|
||||
];
|
||||
if (!process.env.VITEST) {
|
||||
if (!VITE_AVAILABLE_LOCALES || VITE_AVAILABLE_LOCALES === '*' || VITE_AVAILABLE_LOCALES === 'all') {
|
||||
includeLocales = [
|
||||
resolve(__dirname, 'src/tools/*/locales/**'),
|
||||
resolve(__dirname, 'locales/**'),
|
||||
];
|
||||
}
|
||||
else {
|
||||
const fileNameMatching = VITE_AVAILABLE_LOCALES.includes(',') ? `{${VITE_AVAILABLE_LOCALES}}` : VITE_AVAILABLE_LOCALES;
|
||||
includeLocales = [
|
||||
resolve(__dirname, `src/tools/*/locales/${fileNameMatching}.*`),
|
||||
resolve(__dirname, `locales/${fileNameMatching}.*`),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
@@ -28,14 +50,7 @@ export default defineConfig({
|
||||
runtimeOnly: true,
|
||||
compositionOnly: true,
|
||||
fullInstall: true,
|
||||
include: !process.env.VITEST
|
||||
? [
|
||||
resolve(__dirname, 'src/tools/*/locales/**'),
|
||||
resolve(__dirname, 'locales/**'),
|
||||
]
|
||||
: [
|
||||
resolve(__dirname, 'locales/en.yml'),
|
||||
],
|
||||
include: includeLocales,
|
||||
strictMessage: false,
|
||||
escapeHtml: true,
|
||||
}),
|
||||
|
||||
Reference in new issue
Block a user