Skip to content

Commit

Permalink
fix: BASE_IMAGE should be selected via platform
Browse files Browse the repository at this point in the history
  • Loading branch information
mickamy committed Jan 7, 2024

Verified

This commit was signed with the committer’s verified signature.
mickamy Tetsuro Mikami
1 parent 4fa9c5a commit 24cb8a4
Showing 11 changed files with 20 additions and 38 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -62,14 +62,23 @@ jobs:
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
platforms: linux/amd64,linux/arm64/v8
- name: Build and push app image
- name: Build and push base image
uses: docker/build-push-action@v5
with:
context: .
push: true
file: ./docker/app/base/Dockerfile
tags: ${{ env.UNAME }}/ishocon2-app-base:${{ env.DATE }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
platforms: linux/amd64,linux/arm64/v8
- name: Build and push app image
uses: docker/build-push-action@v5
with:
context: .
push: true
file: ./docker/app/${{ env.ISHOCON_APP_LANG }}/Dockerfile
tags: ${{ env.UNAME }}/ishocon2-app-${{ env.ISHOCON_APP_LANG }}:${{ env.DATE }}
build-args: BASE_IMAGE=${{ env.UNAME }}/ishocon2-app-base:latest
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
platforms: linux/amd64,linux/arm64/v8
4 changes: 1 addition & 3 deletions .github/workflows/build_and_push_images.yml
Original file line number Diff line number Diff line change
@@ -99,15 +99,13 @@ jobs:
restore-keys: |
${{ runner.os }}-buildx-${{ matrix.language }}
${{ runner.os }}-buildx
- run: make pull-app
- name: Build and push app image
uses: docker/build-push-action@v5
with:
context: .
push: true
file: ./docker/app/base/Dockerfile
file: ./docker/app/${{ env.ISHOCON_APP_LANG }}/Dockerfile
tags: ${{ env.UNAME }}/ishocon2-app-${{ env.ISHOCON_APP_LANG }}:latest,${{ env.UNAME }}/ishocon2-app-${{ env.ISHOCON_APP_LANG }}:${{ env.DATE }}
build-args: BASE_IMAGE=${{ env.UNAME }}/ishocon2-app-base:${{ env.DATE }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
platforms: linux/amd64,linux/arm64/v8
15 changes: 0 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -7,31 +7,17 @@ ifeq ($(ARCH),)
ARCH = $(shell uname -m)
endif

UBUNTU_VERSION = 18.04

ifeq ($(ARCH), x86_64)
BASE_IMAGE = amd64/ubuntu:$(UBUNTU_VERSION)
else ifeq ($(ARCH), arm64)
BASE_IMAGE = arm64v8/ubuntu:$(UBUNTU_VERSION)
else ifeq ($(ARCH), aarch64)
BASE_IMAGE = arm64v8/ubuntu:$(UBUNTU_VERSION)
else
BASE_IMAGE = ubuntu:$(UBUNTU_VERSION)
endif

LOCAL_ISHOCON_BASE_IMAGE = ishocon2-app-base:latest

build-base:
docker build \
--build-arg BASE_IMAGE=$(BASE_IMAGE) \
-f ./docker/app/base/Dockerfile \
-t $(LOCAL_ISHOCON_BASE_IMAGE) \
-t $(UNAME)/ishocon2-app-base:latest \
.;

build-bench:
docker build \
--build-arg BASE_IMAGE=$(BASE_IMAGE) \
-f ./docker/benchmarker/Dockerfile \
-t ishocon2-bench:latest \
-t $(UNAME)/ishocon2-bench:latest \
@@ -40,7 +26,6 @@ build-bench:
build-app: change-lang build-base
ISHOCON_APP_LANG=$(ISHOCON_APP_LANG:python)
docker build \
--build-arg BASE_IMAGE=$(LOCAL_ISHOCON_BASE_IMAGE) \
-f ./docker/app/$(ISHOCON_APP_LANG)/Dockerfile \
-t ishocon2-app-$(ISHOCON_APP_LANG):latest \
-t $(UNAME)/ishocon2-app-$(ISHOCON_APP_LANG):latest \
5 changes: 1 addition & 4 deletions docker/app/base/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
ARG BASE_IMAGE=ubuntu:18.04
FROM ${BASE_IMAGE}
FROM ubuntu:18.04


USER root

ENV LANG=en_US.UTF-8 \
LC_ALL=C.UTF-8 \
TZ=Asia/Tokyo
3 changes: 1 addition & 2 deletions docker/app/crystal/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
ARG BASE_IMAGE=showwin/ishocon2_app_base:latest
FROM ${BASE_IMAGE}
FROM showwin/ishocon2_app_base:latest

RUN sudo apt update && \
sudo apt install -y \
3 changes: 1 addition & 2 deletions docker/app/go/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
ARG BASE_IMAGE=showwin/ishocon2_app_base:latest
FROM ${BASE_IMAGE}
FROM showwin/ishocon2_app_base:latest

# Go のインストール
ARG TARGETARCH
3 changes: 1 addition & 2 deletions docker/app/nodejs/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
ARG BASE_IMAGE=showwin/ishocon2_app_base:latest
FROM ${BASE_IMAGE}
FROM showwin/ishocon2_app_base:latest

# NodeJS のインストール
RUN sudo apt-get update
3 changes: 1 addition & 2 deletions docker/app/php/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
ARG BASE_IMAGE=showwin/ishocon2_app_base:latest
FROM ${BASE_IMAGE}
FROM showwin/ishocon2_app_base:latest

# PHP のインストール
RUN sudo mkdir /run/php
3 changes: 1 addition & 2 deletions docker/app/python/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
ARG BASE_IMAGE=showwin/ishocon2_app_base:latest
FROM ${BASE_IMAGE}
FROM showwin/ishocon2_app_base:latest

# Python のインストール
RUN sudo apt-get update && \
3 changes: 1 addition & 2 deletions docker/app/ruby/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
ARG BASE_IMAGE=showwin/ishocon2_app_base:latest
FROM ${BASE_IMAGE}
FROM showwin/ishocon2_app_base:latest

# Ruby のインストール
RUN sudo apt-get update && \
3 changes: 1 addition & 2 deletions docker/benchmarker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
ARG BASE_IMAGE=ubuntu:18.04
FROM ${BASE_IMAGE}
FROM ubuntu:18.04

ENV LANG en_US.UTF-8
ENV LC_ALL=C.UTF-8

0 comments on commit 24cb8a4

Please sign in to comment.