apple sicion M2 mac docekr for mac 使用 x86-64 amd64

使用环境变量 指定 docker for mac 适用 Rosetta

  • DOCKER_DEFAULT_PLATFORM=linux/amd64
  • 指定后 docker for mac 使用 Rosetta2
version: '3'
services:
  mule-application:
    environment:
      - DOCKER_DEFAULT_PLATFORM=linux/amd64
    container_name: mule-3.9.0-application
    build:
      context: .
      dockerfile: Dockerfile
    privileged: true
    ports:
      - "8081:8081"
#    command: ["/bin/sh", "-c","sleep 30000000"]

dockerfile 使用 x86-64 amd64

  • --platform=linux/amd64
FROM  --platform=linux/amd64 openjdk:8-jdk-alpine as TEMP_BUILD_IMAGE

WORKDIR /apps/
RUN set -eux && sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
RUN apk update && apk add --no-cache bash curl wget && apk add --no-cache maven
RUN wget https://repository.mulesoft.org/nexus/content/repositories/releases/org/mule/distributions/mule-standalone/3.9.0-20210217/mule-standalone-3.9.0-20210217.tar.gz
RUN tar -zxvf mule-standalone-3.9.0-20210217.tar.gz

WORKDIR /app
COPY src src
COPY pom.xml pom.xml
RUN mvn clean install || return 0
RUN mvn -B  package
RUN mv /app/target/gsb-1.0.0-SNAPSHOT.zip  /apps/mule-standalone-3.9.0-20210217/apps

FROM  --platform=linux/amd64 openjdk:8
ENV TZ=Asia/Shanghai
WORKDIR /app
COPY --from=TEMP_BUILD_IMAGE /apps/mule-standalone-3.9.0-20210217 .
EXPOSE 8000
ENTRYPOINT ["/app/bin/mule"]
posted @ 2023-07-07 11:38  vx_guanchaoguo0  阅读(93)  评论(0编辑  收藏  举报