Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create docker-image.yml #12

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Docker Image CI

on:
push:
branches: ['*']
pull_request:
branches: ['*']

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Build the Docker image
run: docker build . --file Dockerfile --tag my-image-name:$(date +%s)
9 changes: 5 additions & 4 deletions hbs-recompile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

const getAllHbsFiles = (dirPath) => {
let hbsFiles = [];

Expand All @@ -26,9 +29,7 @@ const getAllHbsFiles = (dirPath) => {
};

const recompileTemplates = () => {
const hbsFiles = getAllHbsFiles(
path.resolve(import.meta.dirname, 'components')
);
const hbsFiles = getAllHbsFiles(path.resolve(__dirname, 'components'));
// Формируем команду для компиляции всех найденных файлов
const hbsFilesCommand = hbsFiles.join(' '); // Собираем все файлы в строку для команды
const command = `handlebars ${hbsFilesCommand} -f components/precompiled-templates.js`;
Expand Down Expand Up @@ -62,6 +63,6 @@ const handlebarsCompilePlugin = () => {
export default handlebarsCompilePlugin;

// If file was executed directly
if (process.argv[1] === fileURLToPath(import.meta.url)) {
if (process.argv && process.argv[1] === fileURLToPath(import.meta.url)) {
recompileTemplates();
}
1 change: 1 addition & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import handlebarsCompilePlugin from './hbs-recompile.js';

/** @type {import('vite').UserConfig} */
export default defineConfig({
base: '/2024_2_Fight-club/',
plugins: [handlebarsCompilePlugin()],
server: {
host: 'localhost',
Expand Down