Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ dist
tmp
npm-debug.log
.npmrc
.env*
public/social/
.git
.gitignore
Dockerfile
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ on:
env:
REGISTRY: ghcr.io
IMAGE_NAME: "www-website"
LINKEDIN_SYNC_IMAGE_NAME: "www-website-linkedin-sync"

jobs:
build:
Expand Down Expand Up @@ -41,8 +42,11 @@ jobs:
REPO_NAME="${GITHUB_REPOSITORY##*/}"
IMAGE_NAME="${IMAGE_NAME:-$REPO_NAME}"
IMAGE_NAME="$(echo "${IMAGE_NAME}" | tr '[:upper:]' '[:lower:]')"
LINKEDIN_SYNC_IMAGE_NAME="$(echo "${LINKEDIN_SYNC_IMAGE_NAME}" | tr '[:upper:]' '[:lower:]')"
echo "IMAGE=${REGISTRY}/${OWNER}/${IMAGE_NAME}" >> "$GITHUB_ENV"
echo "LINKEDIN_SYNC_IMAGE=${REGISTRY}/${OWNER}/${LINKEDIN_SYNC_IMAGE_NAME}" >> "$GITHUB_ENV"
echo "Image namespace: ${REGISTRY}/${OWNER}/${IMAGE_NAME}"
echo "LinkedIn sync image namespace: ${REGISTRY}/${OWNER}/${LINKEDIN_SYNC_IMAGE_NAME}"

- name: Compute build info
id: build_info
Expand All @@ -67,6 +71,16 @@ jobs:
type=ref,event=branch,enable=${{ github.ref == 'refs/heads/master' }}
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/master' }}

- name: Docker metadata for LinkedIn sync
id: meta_linkedin_sync
uses: docker/metadata-action@v6
with:
images: ${{ env.LINKEDIN_SYNC_IMAGE }}
tags: |
type=sha
type=ref,event=branch,enable=${{ github.ref == 'refs/heads/master' }}
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/master' }}

- name: Set up Buildx
uses: docker/setup-buildx-action@v4

Expand Down Expand Up @@ -95,6 +109,20 @@ jobs:
cache-from: type=gha
cache-to: type=gha,mode=max,ignore-error=true

- name: Build LinkedIn sync image for tests
uses: docker/build-push-action@v7
with:
context: .
file: ./Dockerfile.linkedin-sync
push: false
load: true
tags: |
${{ env.LINKEDIN_SYNC_IMAGE }}:ci
${{ steps.meta_linkedin_sync.outputs.tags }}
labels: ${{ steps.meta_linkedin_sync.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max,ignore-error=true

- name: Run smoke test
env:
IMAGE_UNDER_TEST: ${{ env.IMAGE }}:ci
Expand Down Expand Up @@ -145,8 +173,11 @@ jobs:
REPO_NAME="${GITHUB_REPOSITORY##*/}"
IMAGE_NAME="${IMAGE_NAME:-$REPO_NAME}"
IMAGE_NAME="$(echo "${IMAGE_NAME}" | tr '[:upper:]' '[:lower:]')"
LINKEDIN_SYNC_IMAGE_NAME="$(echo "${LINKEDIN_SYNC_IMAGE_NAME}" | tr '[:upper:]' '[:lower:]')"
echo "IMAGE=${REGISTRY}/${OWNER}/${IMAGE_NAME}" >> "$GITHUB_ENV"
echo "LINKEDIN_SYNC_IMAGE=${REGISTRY}/${OWNER}/${LINKEDIN_SYNC_IMAGE_NAME}" >> "$GITHUB_ENV"
echo "Image namespace: ${REGISTRY}/${OWNER}/${IMAGE_NAME}"
echo "LinkedIn sync image namespace: ${REGISTRY}/${OWNER}/${LINKEDIN_SYNC_IMAGE_NAME}"

- name: Compute build info
id: build_info
Expand All @@ -171,6 +202,16 @@ jobs:
type=ref,event=branch
type=raw,value=latest

- name: Docker metadata for LinkedIn sync
id: meta_linkedin_sync
uses: docker/metadata-action@v6
with:
images: ${{ env.LINKEDIN_SYNC_IMAGE }}
tags: |
type=sha
type=ref,event=branch
type=raw,value=latest

- name: Set up Buildx
uses: docker/setup-buildx-action@v4

Expand Down Expand Up @@ -216,6 +257,17 @@ jobs:
cache-from: type=gha
cache-to: type=gha,mode=max,ignore-error=true

- name: Build and push LinkedIn sync
uses: docker/build-push-action@v7
with:
context: .
file: ./Dockerfile.linkedin-sync
push: true
tags: ${{ steps.meta_linkedin_sync.outputs.tags }}
labels: ${{ steps.meta_linkedin_sync.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max,ignore-error=true

update-size-badge:
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,6 @@ tmp/

# Generated static documents
/public/pricing.pdf

# Runtime-generated social feed
/public/social/
1 change: 1 addition & 0 deletions Caddyfile.site
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
encode zstd gzip
respond /healthz 200
header /build-info.json Cache-Control "no-store"
header /social/linkedin-posts.json Cache-Control "no-store"
header /_next/static/* Cache-Control "public, max-age=31536000, immutable"
header /optimized/* Cache-Control "public, max-age=604800"
header /partners/* Cache-Control "public, max-age=604800"
Expand Down
11 changes: 11 additions & 0 deletions Dockerfile.linkedin-sync
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# syntax=docker/dockerfile:1

FROM node:22-alpine
WORKDIR /app

ENV NODE_ENV=production

COPY scripts/sync-linkedin-feed.mjs ./scripts/sync-linkedin-feed.mjs

USER node
CMD ["node", "scripts/sync-linkedin-feed.mjs"]
Loading