Updated
This commit is contained in:
parent
82a0fd6eea
commit
4fadb54891
24 changed files with 58 additions and 84 deletions
2
.env
Normal file
2
.env
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
CONTAINER_NAME=dasig-static
|
||||||
|
PORT=4320
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -14,7 +14,6 @@ pnpm-debug.log*
|
||||||
|
|
||||||
|
|
||||||
# environment variables
|
# environment variables
|
||||||
.env
|
|
||||||
.env.local
|
.env.local
|
||||||
.env.production
|
.env.production
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ checkBackground()
|
||||||
}
|
}
|
||||||
|
|
||||||
<style lang="sass">
|
<style lang="sass">
|
||||||
@use '../../configs/design/site.sass' as design
|
@use '../../design/site.sass' as design
|
||||||
|
|
||||||
:root
|
:root
|
||||||
color-scheme: light dark
|
color-scheme: light dark
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ const borderRadius = getBorderRadius(edges)
|
||||||
}
|
}
|
||||||
|
|
||||||
<style lang="sass">
|
<style lang="sass">
|
||||||
@use '/src/styles/fonts.sass' as fonts
|
@use '../../design/fonts.sass' as fonts
|
||||||
@use 'sass:color'
|
@use 'sass:color'
|
||||||
|
|
||||||
$primaryColor: #0075BB
|
$primaryColor: #0075BB
|
||||||
|
|
|
||||||
|
|
@ -47,5 +47,5 @@ const { desktop, tablet, mobile } = Astro.props
|
||||||
}
|
}
|
||||||
|
|
||||||
<style lang="sass">
|
<style lang="sass">
|
||||||
@use '/src/styles/breakpoints.sass'
|
@use '../../design/breakpoints.sass'
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<style lang="sass">
|
<style lang="sass">
|
||||||
@use '../../configs/design/sizes' as view
|
@use '../../design/sizes' as view
|
||||||
|
|
||||||
.dasig-footer
|
.dasig-footer
|
||||||
padding: 1rem 0
|
padding: 1rem 0
|
||||||
|
|
|
||||||
|
|
@ -45,8 +45,8 @@ const config = toml.parse(fs.readFileSync('configs/config.site.toml', 'utf8'))
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
<style lang="sass">
|
<style lang="sass">
|
||||||
@use '../../configs/design/colors.sass' as colors
|
@use '../../design/colors.sass' as colors
|
||||||
@use '/src/styles/fonts.sass' as fonts
|
@use '../../design/fonts.sass' as fonts
|
||||||
|
|
||||||
.body
|
.body
|
||||||
color: colors.$white
|
color: colors.$white
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ const { background, color, border } = Astro.props
|
||||||
}
|
}
|
||||||
|
|
||||||
<style lang="sass">
|
<style lang="sass">
|
||||||
@use '../../configs/design/site' as site
|
@use '../../design/site' as site
|
||||||
@use 'sass:color'
|
@use 'sass:color'
|
||||||
|
|
||||||
.modal
|
.modal
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,3 @@ export { default as Display } from './components/Display.astro'
|
||||||
export { default as Padding } from './components/Padding.astro'
|
export { default as Padding } from './components/Padding.astro'
|
||||||
export { default as Modal } from './components/Modal.astro'
|
export { default as Modal } from './components/Modal.astro'
|
||||||
export { default as Input } from './components/Input.astro'
|
export { default as Input } from './components/Input.astro'
|
||||||
|
|
||||||
// export { default as OptimizeBackground } from './Optimizers/OptimizeBackground'
|
|
||||||
// export { default as OptimizeImage } from './Optimizers/OptimizeImage'
|
|
||||||
// export { default as OptimizeLogo } from './Optimizers/OptimizeLogo'
|
|
||||||
|
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
import { JSEncrypt } from "jsencrypt";
|
|
||||||
import * as fs from "node:fs";
|
|
||||||
import * as toml from "toml";
|
|
||||||
|
|
||||||
const config = toml.parse(
|
|
||||||
fs.readFileSync("configs/config.security.toml", "utf-8"),
|
|
||||||
);
|
|
||||||
const enc = new JSEncrypt();
|
|
||||||
const PUBLIC_KEY = config.rsa.public_key;
|
|
||||||
|
|
||||||
export default (message: string) => {
|
|
||||||
enc.setPublicKey(PUBLIC_KEY);
|
|
||||||
const encrypted = enc.encrypt(message).toString();
|
|
||||||
const fixedEncrypted = encrypted.replace(/\//g, "~");
|
|
||||||
|
|
||||||
return fixedEncrypted;
|
|
||||||
};
|
|
||||||
|
|
@ -1,47 +1,39 @@
|
||||||
import { consola } from "consola";
|
import { consola } from 'consola'
|
||||||
import process from "node:process";
|
import process from 'node:process'
|
||||||
import sharp from "sharp";
|
import sharp from 'sharp'
|
||||||
import yargs from "yargs";
|
import yargs from 'yargs'
|
||||||
import { hideBin } from "yargs/helpers";
|
import { hideBin } from 'yargs/helpers'
|
||||||
|
;(async () => {
|
||||||
(async () => {
|
|
||||||
const argv = yargs(hideBin(process.argv))
|
const argv = yargs(hideBin(process.argv))
|
||||||
.option("name", {
|
.option('name', {
|
||||||
alias: "n",
|
alias: 'n',
|
||||||
describe: "Specify the name of the image",
|
describe: 'Specify the name of the image',
|
||||||
type: "string",
|
type: 'string',
|
||||||
demandOption: true,
|
demandOption: true,
|
||||||
})
|
})
|
||||||
.option("size", {
|
.option('size', {
|
||||||
alias: "s",
|
alias: 's',
|
||||||
describe: "Specify the size of the image",
|
describe: 'Specify the size of the image',
|
||||||
type: "number",
|
type: 'number',
|
||||||
demandOption: true,
|
demandOption: true,
|
||||||
}).argv;
|
}).argv
|
||||||
|
|
||||||
const name = argv.name;
|
const name = argv.name
|
||||||
const size = argv.size;
|
const size = argv.size
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const avifOutputPath = `./@dasig/images/${name.toString().split(".").slice(0, -1).join(".")}.avif`;
|
const avifOutputPath = `./@dasig/images/${name.toString().split('.').slice(0, -1).join('.')}.avif`
|
||||||
const webpOutputPath = `./@dasig/images/${name.toString().split(".").slice(0, -1).join(".")}.webp`;
|
const webpOutputPath = `./@dasig/images/${name.toString().split('.').slice(0, -1).join('.')}.webp`
|
||||||
|
|
||||||
const avifBuffer = await sharp(`./src/images/${name}`)
|
const avifBuffer = await sharp(`./src/images/${name}.png`).avif({ quality: 60 }).resize(size).toBuffer()
|
||||||
.avif({ quality: 60 })
|
await sharp(avifBuffer).toFile(avifOutputPath)
|
||||||
.resize(size)
|
consola.success(`${name} successfully optimized in Avif`)
|
||||||
.toBuffer();
|
|
||||||
await sharp(avifBuffer).toFile(avifOutputPath);
|
|
||||||
consola.success(`${name} successfully optimized in Avif`);
|
|
||||||
|
|
||||||
const webpBuffer = await sharp(`./src/images/${name}`)
|
const webpBuffer = await sharp(`./src/images/${name}.png`).webp({ quality: 75 }).resize(size).toBuffer()
|
||||||
.webp({ quality: 75 })
|
await sharp(webpBuffer).toFile(webpOutputPath)
|
||||||
.resize(size)
|
consola.success(`${name} successfully optimized in Webp`)
|
||||||
.toBuffer();
|
|
||||||
await sharp(webpBuffer).toFile(webpOutputPath);
|
|
||||||
consola.success(`${name} successfully optimized in Webp`);
|
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
consola.error("Error optimizing image:", error);
|
consola.error('Error optimizing image:', error)
|
||||||
if (error.message.includes("missing"))
|
if (error.message.includes('missing')) consola.error(`${name} could not be found on image folder`)
|
||||||
consola.error(`${name} could not be found on image folder`);
|
|
||||||
}
|
}
|
||||||
})();
|
})()
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,6 @@ COPY . .
|
||||||
RUN pnpm build
|
RUN pnpm build
|
||||||
|
|
||||||
FROM nginx:stable-alpine AS runtime
|
FROM nginx:stable-alpine AS runtime
|
||||||
COPY ./nginx/nginx.conf /etc/nginx/nginx.conf
|
COPY ./@dasig/deployment/nginx/nginx.conf /etc/nginx/nginx.conf
|
||||||
COPY --from=build /app/dist /usr/share/nginx/html
|
COPY --from=build /app/dist /usr/share/nginx/html
|
||||||
EXPOSE 4321
|
EXPOSE 4321
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
@use '../../configs/design/sizes.sass' as sizes
|
@use '../design/sizes' as sizes
|
||||||
|
|
||||||
.on-desktop-only
|
.on-desktop-only
|
||||||
@media only screen and (min-width: 0px) and (max-width: sizes.$desktop)
|
@media only screen and (min-width: 0px) and (max-width: sizes.$desktop)
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
services:
|
services:
|
||||||
template:
|
dasig-static:
|
||||||
container_name: template
|
container_name: ${CONTAINER_NAME}
|
||||||
|
image: localhost/${CONTAINER_NAME}:latest
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
ports:
|
ports:
|
||||||
- 4321:4321
|
- ${PORT}:4321
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,14 @@
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=DASIG-ASTRO
|
Description=DASIG-STATIC
|
||||||
|
|
||||||
[Container]
|
[Container]
|
||||||
ContainerName=dasig-astro
|
ContainerName=${CONTAINER_NAME}
|
||||||
Image=localhost/dasig-astro
|
Image=localhost/${CONTAINER_NAME}:latest
|
||||||
PublishPort=4321:4321
|
PublishPort=${PORT}:4321
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Restart=always
|
Restart=always
|
||||||
|
EnvironmentFile=dasig.env
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target default.target
|
WantedBy=multi-user.target default.target
|
||||||
|
|
@ -33,8 +33,8 @@ const count = 0
|
||||||
|
|
||||||
<style lang="sass">
|
<style lang="sass">
|
||||||
@use 'sass:color'
|
@use 'sass:color'
|
||||||
@use '../../configs/design/site' as design
|
@use '../../design/site' as design
|
||||||
@use '../styles/functions.sass' as func
|
@use '../../design/functions.sass' as func
|
||||||
|
|
||||||
.counter
|
.counter
|
||||||
font-family: inherit
|
font-family: inherit
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ import PA2 from '../../@dasig/images/pat-alcala.webp'
|
||||||
</Layout>
|
</Layout>
|
||||||
|
|
||||||
<style lang="sass">
|
<style lang="sass">
|
||||||
@use '../styles/fonts.sass' as fonts
|
@use '../../design/fonts.sass' as fonts
|
||||||
|
|
||||||
h1, h4
|
h1, h4
|
||||||
background: linear-gradient(135deg, #49e1a0 0%, #294e87 100%)
|
background: linear-gradient(135deg, #49e1a0 0%, #294e87 100%)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue