Skip to content

Commit aaae1d1

Browse files
authored
Merge pull request #1 from ivanrdgz03/dev
Dev
2 parents 5dfee52 + 1a0eec4 commit aaae1d1

15 files changed

Lines changed: 435 additions & 376 deletions

.astro/astro/content.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ declare module 'astro:content' {
44
Content: import('astro').MarkdownInstance<{}>['Content'];
55
headings: import('astro').MarkdownHeading[];
66
remarkPluginFrontmatter: Record<string, any>;
7-
components: import('astro').MDXInstance<{}>['components'];
87
}>;
98
}
109
}

.astro/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"_variables": {
3-
"lastUpdateCheck": 1772971528213
3+
"lastUpdateCheck": 1775927117614
44
}
55
}

Dockerfile

Lines changed: 18 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,43 @@
11
# syntax=docker/dockerfile:1
22
ARG NODE_VERSION=20-alpine
3-
ARG NGINX_VERSION=alpine
43

54
FROM node:${NODE_VERSION} AS builder
65

7-
# Install build dependencies
8-
RUN apk add --no-cache libc6-compat
6+
# Public envs used by Astro in client-side code must exist at build time.
7+
ARG PUBLIC_RECAPTCHA_SITE_KEY
8+
ENV PUBLIC_RECAPTCHA_SITE_KEY=${PUBLIC_RECAPTCHA_SITE_KEY}
99

10-
# Configure pnpm
1110
ENV PNPM_HOME="/pnpm"
1211
ENV PATH="$PNPM_HOME:$PATH"
1312
RUN corepack enable
1413

1514
WORKDIR /app
1615

17-
# Copy dependency files first for better caching
1816
COPY package.json pnpm-lock.yaml ./
1917
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
2018

21-
# Copy source code
2219
COPY . .
20+
RUN pnpm run build && find /app/dist -name "*.map" -delete && pnpm prune --prod
2321

24-
# Build application with optimizations
25-
RUN pnpm run build && \
26-
# Remove source maps and unnecessary files
27-
find /app/dist -name "*.map" -delete && \
28-
# Remove dev dependencies
29-
pnpm prune --prod
22+
FROM node:${NODE_VERSION} AS runtime
3023

31-
# Production stage
32-
FROM nginx:${NGINX_VERSION} AS runtime
24+
ENV NODE_ENV=production
25+
ENV HOST=0.0.0.0
26+
ENV PORT=4321
3327

34-
# Install security updates and curl for health check
35-
RUN apk --no-cache upgrade && \
36-
apk --no-cache add curl
37-
38-
# Fix permissions for nginx user
39-
RUN chown -R nginx:nginx /var/cache/nginx && \
40-
chown -R nginx:nginx /var/log/nginx && \
41-
chown -R nginx:nginx /etc/nginx/conf.d && \
42-
touch /var/run/nginx.pid && \
43-
chown -R nginx:nginx /var/run/nginx.pid
44-
45-
# Remove default nginx assets
46-
RUN rm -rf /usr/share/nginx/html/*
47-
48-
# Copy built application with proper ownership
49-
COPY --from=builder --chown=nginx:nginx /app/dist /usr/share/nginx/html
28+
WORKDIR /app
5029

51-
# Remove default nginx config
52-
RUN rm /etc/nginx/conf.d/default.conf
30+
RUN addgroup -S app && adduser -S -G app app
5331

54-
# Copy custom nginx config with proper ownership
55-
COPY --chown=nginx:nginx nginx.conf /etc/nginx/conf.d/default.conf
32+
COPY --from=builder --chown=app:app /app/dist ./dist
33+
COPY --from=builder --chown=app:app /app/package.json ./package.json
34+
COPY --from=builder --chown=app:app /app/node_modules ./node_modules
5635

57-
# Switch to non-root user
58-
USER nginx
36+
USER app
5937

60-
# Expose port
61-
EXPOSE 8080
38+
EXPOSE 4321
6239

63-
# Health check
64-
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
65-
CMD curl -f http://localhost:8080/ || exit 1
40+
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
41+
CMD node -e "fetch('http://127.0.0.1:4321/').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"
6642

67-
# Start nginx
68-
ENTRYPOINT ["nginx", "-g", "daemon off;"]
43+
CMD ["node", "./dist/server/entry.mjs"]

docker-compose.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
11
services:
22
hackiit-website:
3-
build: .
3+
build:
4+
context: .
5+
args:
6+
PUBLIC_RECAPTCHA_SITE_KEY: ${PUBLIC_RECAPTCHA_SITE_KEY}
47
container_name: hackiit-website
8+
environment:
9+
- TELEGRAM_BOT_TOKEN=${TELEGRAM_BOT_TOKEN}
10+
- TELEGRAM_CHAT_ID=${TELEGRAM_CHAT_ID}
11+
- RECAPTCHA_SECRET_KEY=${RECAPTCHA_SECRET_KEY}
12+
- HOST=0.0.0.0
13+
- PORT=4321
514
ports:
6-
- "8080:8080"
15+
- "8080:4321"
716
restart: unless-stopped
817
healthcheck:
9-
test: ["CMD", "curl", "-f", "http://localhost:8080/"]
18+
test: ["CMD", "node", "-e", "fetch('http://127.0.0.1:4321/').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"]
1019
interval: 30s
11-
timeout: 3s
20+
timeout: 5s
1221
retries: 3
13-
start_period: 5s
22+
start_period: 10s

0 commit comments

Comments
 (0)