Skip to content

Commit

Permalink
Fix Dockerfile: Ensure correct paths for JS assets and Golang build s…
Browse files Browse the repository at this point in the history
…tages
  • Loading branch information
shubhadapaithankar committed May 17, 2024
1 parent 0d034e1 commit 2bf360f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 27 deletions.
26 changes: 7 additions & 19 deletions Dockerfile.ci-rp
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,9 @@ RUN npm ci
RUN npm audit --omit=dev # Run audit without dev dependencies

# Copying the rest of the source and build
COPY portal/v2/ ./
RUN npm run lint

# Set permissions to avoid EACCES error
RUN chown -R root:root /build/portal/v2

# Set the build path
ENV BUILD_PATH=../../pkg/portal/assets/v2/build

# Run build with correct permissions
RUN npm run build || (echo "Build failed, listing current directory:" && ls -la)
COPY --chown=root:root portal/v2/ ./
RUN npm run lint && \
npm run build || (echo "Build failed, listing current directory:" && ls -la)

###############################################################################
# Stage 2: Compile the Golang RP code
Expand All @@ -39,11 +31,8 @@ ENV GOPATH=/root/go
ENV GOFLAGS="-tags=containers_image_openpgp,exclude_graphdriver_btrfs,exclude_graphdriver_devicemapper"

# Install golangci-lint and verify
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /usr/local/bin v1.56.2
RUN which golangci-lint || (echo "golangci-lint not found" && exit 1)

# Add /usr/local/bin to the PATH
ENV PATH="/usr/local/bin:${PATH}"
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /usr/local/bin v1.56.2 && \
golangci-lint --version || (echo "golangci-lint not found" && exit 1)

# Copy dependencies and source files
COPY go.mod go.sum ./
Expand All @@ -56,7 +45,7 @@ COPY pkg pkg
COPY test test

# Ensure JS assets are available before generating Go code
COPY --from=portal-build /build/portal/v2/${BUILD_PATH} /app/pkg/portal/assets/v2/build
COPY --from=portal-build /build/pkg/portal/assets/v2/ /app/pkg/portal/assets/v2/build

# Lint, generate, build, and test
RUN golangci-lint run --verbose
Expand All @@ -73,8 +62,7 @@ RUN hack/fips/validate-fips.sh ./aro
###############################################################################
FROM ${REGISTRY}/ubi8/ubi-minimal AS final
RUN microdnf update && microdnf clean all
COPY --from=builder /app/aro /app/e2e.test /usr/local/bin/
COPY --from=builder /app/cmd/aro /app/cmd/aro
COPY --from=builder /app/aro /app/e2e.test /usr/local/bin/
ENTRYPOINT ["aro"]
EXPOSE 2222/tcp 8080/tcp 8443/tcp 8444/tcp 8445/tcp
USER 1000
14 changes: 6 additions & 8 deletions Dockerfile.ci-rp.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@

# Allow files and directories for JavaScript build
!portal/v2/package*.json
!portal/v2/*.js
!portal/v2/*.jsx
!portal/v2/*.ts
!portal/v2/*.tsx
!portal/v2/*.css
!portal/v2/*.scss
!portal/v2/*.html
portal/v2/node_modules/
!portal/v2/src
!portal/v2/public
!portal/v2/config-overrides.js
!portal/v2/tsconfig.json
!portal/v2/.eslintrc.yml
!portal/v2/.npmrc

0 comments on commit 2bf360f

Please sign in to comment.