mirror of
https://github.com/StepanovPlaton/AboutMe.git
synced 2026-04-03 20:30:49 +04:00
Update docker deploy
This commit is contained in:
49
Dockerfile
49
Dockerfile
@@ -1,41 +1,40 @@
|
|||||||
# Stage 1: Build
|
# Используем официальный Node.js образ
|
||||||
FROM node:22-alpine AS builder
|
FROM node:22-alpine
|
||||||
|
|
||||||
# Set working directory
|
# Устанавливаем pnpm глобально
|
||||||
|
RUN npm install -g pnpm@9.14.4
|
||||||
|
|
||||||
|
# Устанавливаем рабочую директорию
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy package files
|
# Копируем файлы конфигурации пакетов
|
||||||
COPY package.json package-lock.json* ./
|
COPY package.json pnpm-lock.yaml ./
|
||||||
|
|
||||||
# Install dependencies
|
# Устанавливаем зависимости
|
||||||
RUN npm ci
|
RUN pnpm install --frozen-lockfile
|
||||||
|
|
||||||
# Copy source code
|
# Копируем остальные файлы проекта
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
|
# Устанавливаем переменную окружения для Docker
|
||||||
|
ENV DOCKER=true
|
||||||
|
|
||||||
# Accept build arguments and set environment variables
|
# Accept build arguments and set environment variables
|
||||||
ARG OAUTH_GITHUB_CLIENT_ID
|
ARG OAUTH_GITHUB_CLIENT_ID
|
||||||
ARG OAUTH_GITHUB_CLIENT_SECRET
|
ARG OAUTH_GITHUB_CLIENT_SECRET
|
||||||
ENV OAUTH_GITHUB_CLIENT_ID=${OAUTH_GITHUB_CLIENT_ID}
|
ENV OAUTH_GITHUB_CLIENT_ID=${OAUTH_GITHUB_CLIENT_ID}
|
||||||
ENV OAUTH_GITHUB_CLIENT_SECRET=${OAUTH_GITHUB_CLIENT_SECRET}
|
ENV OAUTH_GITHUB_CLIENT_SECRET=${OAUTH_GITHUB_CLIENT_SECRET}
|
||||||
|
|
||||||
# Build the application
|
# Собираем проект
|
||||||
RUN npm run build
|
RUN pnpm run build
|
||||||
|
|
||||||
# Stage 2: Production
|
# Открываем порт (Node.js adapter по умолчанию использует 4321)
|
||||||
FROM nginx:alpine AS production
|
EXPOSE 4321
|
||||||
|
|
||||||
# Remove default nginx config
|
# Устанавливаем переменную окружения для порта
|
||||||
RUN rm -f /etc/nginx/conf.d/default.conf
|
ENV PORT=4321
|
||||||
|
ENV HOST=0.0.0.0
|
||||||
|
|
||||||
# Copy built files from builder stage
|
# Запускаем Astro сервер через Node.js adapter
|
||||||
COPY --from=builder /app/dist/client /usr/share/nginx/html
|
# В standalone режиме entry point находится в dist/server/entry.mjs
|
||||||
|
CMD ["node", "dist/server/entry.mjs"]
|
||||||
# Copy nginx configuration
|
|
||||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
||||||
|
|
||||||
# Expose port 8091
|
|
||||||
EXPOSE 8091
|
|
||||||
|
|
||||||
# Start nginx
|
|
||||||
CMD ["nginx", "-g", "daemon off;"]
|
|
||||||
@@ -7,6 +7,7 @@ import swup from "@swup/astro";
|
|||||||
import sitemap from "@astrojs/sitemap";
|
import sitemap from "@astrojs/sitemap";
|
||||||
import vercel from "@astrojs/vercel";
|
import vercel from "@astrojs/vercel";
|
||||||
import cloudflarePages from "@astrojs/cloudflare";
|
import cloudflarePages from "@astrojs/cloudflare";
|
||||||
|
import node from "@astrojs/node";
|
||||||
import decapCmsOauth from "astro-decap-cms-oauth";
|
import decapCmsOauth from "astro-decap-cms-oauth";
|
||||||
import expressiveCode from "astro-expressive-code";
|
import expressiveCode from "astro-expressive-code";
|
||||||
import icon from "astro-icon";
|
import icon from "astro-icon";
|
||||||
@@ -34,7 +35,11 @@ import { remarkReadingTime } from "./src/plugins/remark-reading-time.mjs";
|
|||||||
|
|
||||||
// https://astro.build/config
|
// https://astro.build/config
|
||||||
// Choose adapter depending on deployment environment
|
// Choose adapter depending on deployment environment
|
||||||
const adapter = process.env.CF_PAGES ? cloudflarePages() : vercel({ mode: "serverless" });
|
const adapter = process.env.CF_PAGES
|
||||||
|
? cloudflarePages()
|
||||||
|
: process.env.DOCKER
|
||||||
|
? node({ mode: "standalone" })
|
||||||
|
: vercel({ mode: "serverless" });
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
site: siteConfig.siteURL,
|
site: siteConfig.siteURL,
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
"@astrojs/sitemap": "^3.7.0",
|
"@astrojs/sitemap": "^3.7.0",
|
||||||
"@astrojs/svelte": "7.2.5",
|
"@astrojs/svelte": "7.2.5",
|
||||||
"@astrojs/vercel": "^9.0.4",
|
"@astrojs/vercel": "^9.0.4",
|
||||||
|
"@astrojs/node": "^8.4.0",
|
||||||
"@expressive-code/core": "^0.41.6",
|
"@expressive-code/core": "^0.41.6",
|
||||||
"@expressive-code/plugin-collapsible-sections": "^0.41.6",
|
"@expressive-code/plugin-collapsible-sections": "^0.41.6",
|
||||||
"@expressive-code/plugin-line-numbers": "^0.41.6",
|
"@expressive-code/plugin-line-numbers": "^0.41.6",
|
||||||
|
|||||||
Binary file not shown.
BIN
public/assets/music/move.mp3
Normal file
BIN
public/assets/music/move.mp3
Normal file
Binary file not shown.
Reference in New Issue
Block a user