Skip to content

Commit

Permalink
Update dockerfile to not include optional deps (redhat-developer#238)
Browse files Browse the repository at this point in the history
* Update dockerfile to use --ignore-optional

Signed-off-by: Paul Schultz <[email protected]>

Update dockerfile to use --ignore-optional

Signed-off-by: Paul Schultz <[email protected]>

* Update docker build action to not use cache for workflow dispatch

Signed-off-by: Paul Schultz <[email protected]>

---------

Signed-off-by: Paul Schultz <[email protected]>
  • Loading branch information
schultzp2020 authored May 4, 2023
1 parent fedcc2b commit 049394e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*.less eol=lf
*.styl eol=lf
*.js eol=lf
*.cjs eol=lf
*.ts eol=lf
*.jsx eol=lf
*.tsx eol=lf
Expand Down
15 changes: 11 additions & 4 deletions .github/workflows/docker-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,17 @@ jobs:
tags: type=sha

- name: Build and push Docker image
if: github.event_name == 'workflow_dispatch'
uses: docker/build-push-action@v4
with:
context: .
push: ${{ github.event_name == 'push' }}
provenance: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Build and push Docker image
if: github.event_name != 'workflow_dispatch'
uses: docker/build-push-action@v4
with:
context: .
Expand All @@ -92,10 +103,6 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
build-args: |
TECHDOCS_BUILDER_TYPE=external
TECHDOCS_GENERATOR_TYPE=local
TECHDOCS_PUBLISHER_TYPE=awsS3

- # Temp fix
# https://github.com/docker/build-push-action/issues/252
Expand Down
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ COPY .yarnrc.yml ./
RUN find packages -mindepth 2 -maxdepth 2 \! -name "package.json" -exec rm -rf {} \+

ENV IS_CONTAINER="TRUE"
RUN $YARN install --frozen-lockfile --network-timeout 600000
RUN $YARN add -D -W --arch=x64 --platform=linux turbo
RUN $YARN add -D -W --arch=x64 --platform=linux @esbuild/linux-x64
RUN $YARN install --frozen-lockfile --network-timeout 600000 --ignore-optional

# Stage 2 - Build packages
FROM registry.access.redhat.com/ubi9/nodejs-18-minimal:latest AS build
Expand Down Expand Up @@ -59,7 +61,7 @@ RUN tar xzf skeleton.tar.gz && rm skeleton.tar.gz

# Install production dependencies
ENV IS_CONTAINER="TRUE"
RUN $YARN install --frozen-lockfile --production --network-timeout 600000 && $YARN cache clean
RUN $YARN install --frozen-lockfile --production --network-timeout 600000 --ignore-optional && $YARN cache clean

# Copy the built packages from the build stage
COPY --from=build /opt/app-root/src/packages/backend/dist/bundle.tar.gz .
Expand Down

0 comments on commit 049394e

Please sign in to comment.