fix(ci): lowercase Docker image name in CI workflow and optimize Dockerfile layer creation
This commit is contained in:
@@ -45,6 +45,9 @@ jobs:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Lowercase image name
|
||||
run: echo "IMAGE_NAME=ghcr.io/$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
@@ -55,7 +58,7 @@ jobs:
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ghcr.io/${{ github.repository }}
|
||||
images: ${{ env.IMAGE_NAME }}
|
||||
flavor: |
|
||||
latest=auto
|
||||
tags: |
|
||||
|
||||
+4
-5
@@ -15,14 +15,13 @@ WORKDIR /app
|
||||
ENV NODE_ENV=production
|
||||
|
||||
# Copy installed production node_modules from builder
|
||||
COPY --from=builder /app/node_modules ./node_modules
|
||||
COPY --chown=bun:bun --from=builder /app/node_modules ./node_modules
|
||||
|
||||
# Copy application configuration and source code
|
||||
COPY package.json tsconfig.json ./
|
||||
COPY src ./src
|
||||
COPY --chown=bun:bun package.json tsconfig.json ./
|
||||
COPY --chown=bun:bun src ./src
|
||||
|
||||
# Set ownership and drop root privileges
|
||||
RUN chown -R bun:bun /app
|
||||
# Drop root privileges
|
||||
USER bun
|
||||
|
||||
# Standard MCP stdio communication
|
||||
|
||||
@@ -44,7 +44,8 @@ describe("GitHub Actions CI Workflow", () => {
|
||||
expect(content).toContain("docker/setup-qemu-action@v3");
|
||||
expect(content).toContain("docker/setup-buildx-action@v3");
|
||||
expect(content).toContain("docker/metadata-action@v5");
|
||||
expect(content).toContain("ghcr.io/${{ github.repository }}");
|
||||
expect(content).toContain("IMAGE_NAME=ghcr.io/$(echo \"${{ github.repository }}\" | tr '[:upper:]' '[:lower:]')");
|
||||
expect(content).toContain("images: ${{ env.IMAGE_NAME }}");
|
||||
expect(content).toContain("docker/login-action@v3");
|
||||
expect(content).toContain("registry: ghcr.io");
|
||||
expect(content).toContain("docker/build-push-action@v6");
|
||||
|
||||
Reference in New Issue
Block a user