diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..c8d3dac --- /dev/null +++ b/.dockerignore @@ -0,0 +1,13 @@ +node_modules/ +npm-debug.log +.git +.gitignore +.DS_Store +.astro/ +dist/ +.idea/ +.vscode/ +.github/ +.env.local +.env.*.local +*.log diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index fa4a9db..fde789f 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -22,8 +22,8 @@ concurrency: cancel-in-progress: false jobs: - # Single deploy job since we're just deploying - deploy: + # Build and deploy job + build-and-deploy: environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} @@ -31,13 +31,26 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '18' + + - name: Install dependencies + run: npm ci + + - name: Build with Astro + run: npm run build + - name: Setup Pages uses: actions/configure-pages@v5 + - name: Upload artifact uses: actions/upload-pages-artifact@v3 with: - # Upload entire repository - path: 'public' + path: 'dist' + - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v4 diff --git a/Dockerfile b/Dockerfile index 8952d98..8a7e443 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,18 @@ -FROM nginx:alpine +# Build stage +FROM node:20-slim AS builder -COPY public/ /usr/share/nginx/html/ +WORKDIR /app + +COPY package.json ./ +RUN npm install + +COPY . . +RUN npm run build + +# Production stage +FROM nginx:latest + +COPY --from=builder /app/dist /usr/share/nginx/html/ EXPOSE 80