Skip to content

Commit

Permalink
Use multi-stage container build
Browse files Browse the repository at this point in the history
  • Loading branch information
gbraad committed May 17, 2023
1 parent 9faf871 commit 771e38e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 28 deletions.
23 changes: 0 additions & 23 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,29 +34,6 @@ jobs:

- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: 16

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(npx yarn cache dir)" >> ${GITHUB_OUTPUT}

- uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Execute yarn
if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
run: npx yarn --frozen-lockfile --network-timeout 180000

- name: Run Build
run: npx yarn build

- name: Login to ghcr.io
uses: docker/login-action@v2
with:
Expand Down
19 changes: 14 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,24 @@
#
# SPDX-License-Identifier: Apache-2.0

FROM registry.access.redhat.com/ubi9/nodejs-18:latest AS builder

COPY . .

RUN npm install -g yarn \
&& npx yarn install \
&& npx yarn build


FROM scratch

LABEL org.opencontainers.image.title="Red Hat OpenShift Local" \
org.opencontainers.image.description="Integration for Red Hat OpenShift Local clusters" \
org.opencontainers.image.vendor="redhat" \
io.podman-desktop.api.version=">= 0.16.0"

COPY package.json /extension/
COPY LICENSE /extension/
COPY README.md /extension/
COPY icon.png /extension/
COPY dist /extension/dist
COPY --from=builder /opt/app-root/src/package.json /extension/
COPY --from=builder /opt/app-root/src/LICENSE /extension/
COPY --from=builder /opt/app-root/src/README.md /extension/
COPY --from=builder /opt/app-root/src/icon.png /extension/
COPY --from=builder /opt/app-root/src/dist /extension/dist

0 comments on commit 771e38e

Please sign in to comment.