mirror of
https://github.com/StepanovPlaton/AboutMe.git
synced 2026-04-03 12:20:48 +04:00
Update docker deploy
This commit is contained in:
49
Dockerfile
49
Dockerfile
@@ -1,41 +1,40 @@
|
||||
# Stage 1: Build
|
||||
FROM node:22-alpine AS builder
|
||||
# Используем официальный Node.js образ
|
||||
FROM node:22-alpine
|
||||
|
||||
# Set working directory
|
||||
# Устанавливаем pnpm глобально
|
||||
RUN npm install -g pnpm@9.14.4
|
||||
|
||||
# Устанавливаем рабочую директорию
|
||||
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 . .
|
||||
|
||||
# Устанавливаем переменную окружения для Docker
|
||||
ENV DOCKER=true
|
||||
|
||||
# Accept build arguments and set environment variables
|
||||
ARG OAUTH_GITHUB_CLIENT_ID
|
||||
ARG OAUTH_GITHUB_CLIENT_SECRET
|
||||
ENV OAUTH_GITHUB_CLIENT_ID=${OAUTH_GITHUB_CLIENT_ID}
|
||||
ENV OAUTH_GITHUB_CLIENT_SECRET=${OAUTH_GITHUB_CLIENT_SECRET}
|
||||
|
||||
# Build the application
|
||||
RUN npm run build
|
||||
# Собираем проект
|
||||
RUN pnpm run build
|
||||
|
||||
# Stage 2: Production
|
||||
FROM nginx:alpine AS production
|
||||
# Открываем порт (Node.js adapter по умолчанию использует 4321)
|
||||
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
|
||||
COPY --from=builder /app/dist/client /usr/share/nginx/html
|
||||
|
||||
# Copy nginx configuration
|
||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
# Expose port 8091
|
||||
EXPOSE 8091
|
||||
|
||||
# Start nginx
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
# Запускаем Astro сервер через Node.js adapter
|
||||
# В standalone режиме entry point находится в dist/server/entry.mjs
|
||||
CMD ["node", "dist/server/entry.mjs"]
|
||||
@@ -7,6 +7,7 @@ import swup from "@swup/astro";
|
||||
import sitemap from "@astrojs/sitemap";
|
||||
import vercel from "@astrojs/vercel";
|
||||
import cloudflarePages from "@astrojs/cloudflare";
|
||||
import node from "@astrojs/node";
|
||||
import decapCmsOauth from "astro-decap-cms-oauth";
|
||||
import expressiveCode from "astro-expressive-code";
|
||||
import icon from "astro-icon";
|
||||
@@ -34,7 +35,11 @@ import { remarkReadingTime } from "./src/plugins/remark-reading-time.mjs";
|
||||
|
||||
// https://astro.build/config
|
||||
// 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({
|
||||
site: siteConfig.siteURL,
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
"@astrojs/sitemap": "^3.7.0",
|
||||
"@astrojs/svelte": "7.2.5",
|
||||
"@astrojs/vercel": "^9.0.4",
|
||||
"@astrojs/node": "^8.4.0",
|
||||
"@expressive-code/core": "^0.41.6",
|
||||
"@expressive-code/plugin-collapsible-sections": "^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