Worker App build error
vamagithub opened this issue · 9 comments
Same issue encountered here, wondering if there is any help??
Description 描述
docker compose uprenders the following error while building an image for the worker app.docker compose up在为工作应用程序构建图像时呈现以下错误。
Hi! Actually I just found some solutions, here is a new Yaml file which works. You might want to replace it into the older one.
apiVersion: apps/v1
kind: Deployment
metadata:
name: postgres-deployment
labels:
app: demo-voting-app
spec:
replicas: 1
selector:
matchLabels:
name: postgres-pod
app: demo-voting-app
template:
metadata:
name: postgres-pod
labels:
name: postgres-pod
app: demo-voting-app
spec:
containers:
- name: postgres
image: postgres:9.4
env:
- name: POSTGRES_USER
value: postgres
- name: POSTGRES_PASSWORD
value: postgres
- name: POSTGRES_HOST_AUTH_METHOD
value: trust
ports:
- containerPort: 5432
Same error for me as well, is it officially fixed now?
can you share the repo with me please. thanks man
We manage to work:
docker-compose.yml
`
worker:
platform: linux/amd64
environment:
- DOCKER_DEFAULT_PLATFORM=linux/amd64
build:
args:
TARGETPLATFORM: linux/amd64
TARGETARCH: amd64
context: ./worker
depends_on:
redis:
condition: service_healthy
db:
condition: service_healthy
networks:
- back-tier
`
worker/Dockerfile:
`
FROM --platform=linux/amd64 mcr.microsoft.com/dotnet/sdk:7.0 as build
ARG TARGETPLATFORM
ARG TARGETARCH
#ARG BUILDPLATFORM
RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM"
WORKDIR /source
COPY *.csproj .
RUN dotnet restore -a $TARGETARCH
COPY . .
RUN dotnet publish -c release -o /app -a $TARGETARCH --self-contained false --no-restore
# app image
FROM mcr.microsoft.com/dotnet/runtime:7.0
WORKDIR /app
COPY --from=build /app .
ENTRYPOINT ["dotnet", "Worker.dll"]
`

