Skip to content

Commit

Permalink
Try to fix pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
EhabY committed Nov 11, 2024
1 parent 8e749d2 commit b2500f7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/docker-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ jobs:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
id: release
Expand Down
23 changes: 10 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
# Base stage for the front end (used for both build and test)
FROM node:22-alpine3.19 AS frontend-base
# Stage 1: Build and test the frontend
FROM node:22-alpine3.19 AS frontend-build
WORKDIR /ui
COPY ui/package.json ui/package-lock.json ./
RUN npm install
COPY ui/ ./

# Stage 1: Build the front end
FROM frontend-base AS frontend-build
RUN npm run build

# Stage 2: Test the front end
FROM frontend-base AS frontend-test
RUN npm run build
# Stage 2: Test the frontend (run tests before building backend)
FROM frontend-build AS frontend-test
WORKDIR /ui
RUN npm test

# Stage 3: Build the backend
Expand All @@ -25,13 +22,13 @@ COPY web/ web/
COPY swarmcd/ swarmcd/
RUN CGO_ENABLED=0 GOOS=linux go build -o /swarm-cd ./cmd/

# Stage 4: Test the backend (if applicable)
# FROM backend-build AS backend-test

# Stage 5: Packaging
FROM alpine:3.2 AS final
# Stage 4: Final production image
FROM alpine:3.2
WORKDIR /app
RUN apk add --no-cache ca-certificates && update-ca-certificates
# Copy the built frontend from the frontend build stage
COPY --from=frontend-build /ui/dist/ /app/ui/
# Copy the built backend binary from the backend build stage
COPY --from=backend-build /swarm-cd /app/
# Set the entry point for the application
CMD ["/app/swarm-cd"]

0 comments on commit b2500f7

Please sign in to comment.