Skip to content

Commit 50c0530

Browse files
committed
publish docker images
1 parent ccade59 commit 50c0530

File tree

2 files changed

+33
-12
lines changed

2 files changed

+33
-12
lines changed

.github/workflows/ci.yml

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,38 +11,50 @@ on:
1111
jobs:
1212
build:
1313
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
packages: write
1417

1518
steps:
1619
- name: Checkout code
1720
uses: actions/checkout@v3
1821
with:
1922
fetch-depth: 0
20-
23+
2124
- name: Setup Node.js
2225
uses: actions/setup-node@v3
2326
with:
24-
node-version: '18'
25-
27+
node-version: "18"
28+
2629
- name: Install dependencies
2730
run: cd ./site/ && npm install
28-
31+
2932
- name: Build site
3033
run: cd ./site/ && npm run build
3134
env:
3235
VITE_SCIM_TEST_SERVER_URL: ${{ secrets.VITE_SCIM_TEST_SERVER_URL }}
3336
VITE_TURNSTILE_SITE_KEY: ${{ secrets.VITE_TURNSTILE_SITE_KEY }}
34-
37+
3538
- name: Install Netlify CLI
3639
run: npm install -g netlify-cli
37-
40+
3841
- name: Deploy to Netlify
3942
run: netlify deploy --prod --dir=./site/.vitepress/dist
4043
env:
4144
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
4245
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
43-
46+
4447
- name: Push to dokku
4548
uses: dokku/github-action@master
4649
with:
47-
git_remote_url: 'ssh://[email protected]:22/api'
50+
git_remote_url: "ssh://[email protected]:22/api"
4851
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}
52+
53+
- name: Build image
54+
run: docker build -f Dockerfile.cli -t ghcr.io/${{ github.repository }}:latest .
55+
56+
- name: Authenticate to GHCR
57+
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
58+
59+
- name: Push image
60+
run: docker push ghcr.io/${{ github.repository }}:latest

Dockerfile.cli

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,27 @@
11
# docker build -f Dockerfile.cli -t my-cli .
22
# docker run -e CONFIG_FILE=/app/config.yaml -e AUTH_HEADER="Bearer JdwETA7axAMc6AK35KYRclJDaoDkkRo4BaQtUnZZBvh1BqZ5RPSBZdA18ydD" -e BASE_URL="https://api.scim.dev/scim/v2" -e HAR_FILE_NAME="/output/output.har" -v $(pwd)/site/.vitepress/theme/components/config.yaml:/app/config.yaml -v $(pwd)/output/:/output my-cli
33

4-
FROM node:21-alpine
4+
FROM node:21-alpine AS build
55

66
WORKDIR /app
77

8-
# Copy package.json and package-lock.json
8+
# Copy package files
99
COPY package*.json ./
1010

1111
# Install dependencies
1212
RUN npm ci --only=production
1313

14-
# Copy the rest of the application
15-
COPY . .
14+
# Create a smaller final image
15+
FROM node:21-alpine
16+
17+
WORKDIR /app
18+
19+
# Copy only the necessary files from the build stage
20+
COPY --from=build /app/node_modules ./node_modules
21+
COPY src/ ./src/
22+
COPY reporters/ ./reporters/
23+
COPY *.js ./
24+
COPY *.json ./
1625

1726
# Set the entrypoint
1827
ENTRYPOINT ["node", "--test"]

0 commit comments

Comments
 (0)