0

running buildah github action to build the container below

FROM docker.io/library/dart:stable AS build

COPY . /app
WORKDIR /app
RUN dart compile exe ./bin/server.dart -o ./server

FROM scratch
COPY --from=build /runtime/ /
COPY --from=build /app/ /bin

EXPOSE 8080
CMD ["server"]

I get this error

[1/2] STEP 1/5: FROM docker.io/library/dart:stable AS build
Trying to pull docker.io/library/dart:stable...
Getting image source signatures
[...]
Writing manifest to image destination
Storing signatures
[1/2] STEP 2/5: COPY . /app
[1/2] STEP 3/5: WORKDIR /app
[1/2] STEP 4/5: RUN mkdir build
[1/2] STEP 5/5: RUN dart compile exe ./bin/server.dart -o ./server
"./bin/server.dart" file not found.
error building at STEP "RUN dart compile exe ./bin/server.dart -o ./server": error while running runtime: exit status 255
[2/2] STEP 1/5: FROM scratch
time="2022-12-02T09:04:48Z" level=error msg="exit status 255"
Error: Error: buildah exited with code 255
Trying to pull docker.io/library/dart:stable...
Getting image source signatures
[...]
Writing manifest to image destination
Storing signatures

error building at STEP "RUN dart compile exe ./bin/server.dart -o ./...

but running it locally with podman I have no issues here is my github workflow

name: 'publish containers'
on:
  push:
    branches:
      - master

# https://github.com/redhat-actions/push-to-registry/blob/main/.github/workflows/ghcr-push.yaml
env:
  REGISTRY_USER: ${{ github.actor }}
  REGISTRY_PASSWORD: ${{ github.token }}
  IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}
  IMAGE_TAGS: v1 ${{ github.sha }}

jobs:
  push-ghcr:
    name: build and push image
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      # https://github.com/redhat-actions/podman-login
      # https://github.com/redhat-actions/buildah-build#using-private-images
      - name: login to ghcr
        uses: redhat-actions/podman-login@v1
        with:
          username: ${{ env.REGISTRY_USER }}
          password: ${{ env.REGISTRY_PASSWORD }}
          registry: ${{ env.IMAGE_REGISTRY }}

      - name: build image
        id: build_image
        uses: redhat-actions/buildah-build@v2
        with:
          image: server
          tags: latest ${{ env.IMAGE_TAGS }}
          containerfiles: |
            server/Containerfile

      - name: push to ghcr
        uses: redhat-actions/push-to-registry@v2
        id: push
        with:
          image: ${{ steps.build_image.outputs.image }}
          tags: ${{ steps.build_image.outputs.tags }}
          registry: ${{ env.IMAGE_REGISTRY }}
          username: ${{ env.REGISTRY_USER }}
          password: ${{ env.REGISTRY_PASSWORD }}

it seems to me that fails to pull the image from docker, but again it pulls ur locally any idea what did I do wrong?

Francesco Iapicca
  • 2,618
  • 5
  • 40
  • 85

0 Answers0