Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build arm image #50

Merged
merged 2 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 27 additions & 5 deletions .github/workflows/docker_build_and_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,32 @@ jobs:
build_and_push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build the Docker image
run: docker build . -t planetariumhq/libplanet-seed:git-${{ github.sha }}
- name: checkout
uses: actions/checkout@v3
- name: login
run: docker login -u '${{ secrets.DOCKER_USERNAME }}' -p '${{ secrets.DOCKER_ACCESS_TOKEN }}'
- name: push git version
run: docker push planetariumhq/libplanet-seed:git-${{ github.sha }}
- name: setup-qemu
run: |
docker run --rm --privileged multiarch/qemu-user-static \
--reset \
-p yes
- name: build-and-push-amd64
run: |
docker build . \
-f ${{ matrix.docker.dockerfile }}.amd64 \
-t ${{ matrix.docker.repo }}:git-${{ github.sha }}-amd64 \
--build-arg COMMIT=git-${{ github.sha }}
docker push ${{ matrix.docker.repo }}:git-${{ github.sha }}-amd64
- name: build-and-push-arm64v8
run: |
docker build . \
-f ${{ matrix.docker.dockerfile }}.arm64v8 \
-t ${{ matrix.docker.repo }}:git-${{ github.sha }}-arm64v8 \
--build-arg COMMIT=git-${{ github.sha }}
docker push ${{ matrix.docker.repo }}:git-${{ github.sha }}-arm64v8
- name: merge-manifest-and-push
run: |
docker manifest create ${{ matrix.docker.repo }}:git-${{ github.sha }} \
--amend ${{ matrix.docker.repo }}:git-${{ github.sha }}-amd64 \
--amend ${{ matrix.docker.repo }}:git-${{ github.sha }}-arm64v8
docker manifest push ${{ matrix.docker.repo }}:git-${{ github.sha }}
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build-env
WORKDIR /app
ARG COMMIT

# Copy csproj and restore as distinct layers
COPY ./Libplanet.Seed/Libplanet.Seed.csproj ./Libplanet.Seed/
Expand All @@ -9,7 +10,7 @@ RUN dotnet restore Libplanet.Seed.Executable

# Copy everything else and build
COPY . ./
RUN dotnet publish -c Release -r linux-x64 -o out
RUN dotnet publish -c Release -r linux-x64 -o out --version-suffix $COMMIT

# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:6.0
Expand Down
30 changes: 30 additions & 0 deletions Dockerfile.amd64
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build-env
WORKDIR /app
ARG COMMIT

# Copy csproj and restore as distinct layers
COPY ./Libplanet.Seed/Libplanet.Seed.csproj ./Libplanet.Seed/
COPY ./Libplanet.Seed.Executable/Libplanet.Seed.Executable.csproj ./Libplanet.Seed.Executable/
RUN dotnet restore Libplanet.Seed
RUN dotnet restore Libplanet.Seed.Executable

# Copy everything else and build
COPY . ./
RUN dotnet publish -c Release -r linux-x64 -o out --version-suffix $COMMIT

# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:6.0-bullseye-slim
WORKDIR /app
COPY --from=build-env /app/out .

# Install native deps
RUN apt-get update \
&& apt-get install -y --allow-unauthenticated \
libc6-dev \
&& rm -rf /var/lib/apt/lists/*

# Runtime settings
EXPOSE 5000
VOLUME /data

ENTRYPOINT ["/app/Libplanet.Seed.Executable"]
30 changes: 30 additions & 0 deletions Dockerfile.arm64v8
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build-env
WORKDIR /app
ARG COMMIT

# Copy csproj and restore as distinct layers
COPY ./Libplanet.Seed/Libplanet.Seed.csproj ./Libplanet.Seed/
COPY ./Libplanet.Seed.Executable/Libplanet.Seed.Executable.csproj ./Libplanet.Seed.Executable/
RUN dotnet restore Libplanet.Seed
RUN dotnet restore Libplanet.Seed.Executable

# Copy everything else and build
COPY . ./
RUN dotnet publish -c Release -r linux-arm64 -o out --version-suffix $COMMIT

# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:6.0-bullseye-slim-arm64v8
WORKDIR /app
COPY --from=build-env /app/out .

# Install native deps
RUN apt-get update \
&& apt-get install -y --allow-unauthenticated \
libc6-dev \
&& rm -rf /var/lib/apt/lists/*

# Runtime settings
EXPOSE 5000
VOLUME /data

ENTRYPOINT ["/app/Libplanet.Seed.Executable"]
Loading