From 3e2947a81ee958b35e7e49ab1f95a777bc6caf45 Mon Sep 17 00:00:00 2001 From: FUJIWARA Shunichiro Date: Thu, 23 Jun 2022 12:01:59 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=B3=E3=83=B3=E3=83=86=E3=83=8A=E3=82=A4?= =?UTF-8?q?=E3=83=A1=E3=83=BC=E3=82=B8=E3=82=92=E8=A8=80=E8=AA=9E=E5=85=AC?= =?UTF-8?q?=E5=BC=8F=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 移植を考えると、Ubuntuに各言語を入れるより言語公式のほうが楽そう ベースが Ubuntu -> Debian(11 bullseye)になるのでMySQL8の入れ方が変わります --- docker-compose.yml | 6 +++--- webapp/Dockerfile | 17 ----------------- webapp/go/Dockerfile | 20 ++++++++++++++++++++ 3 files changed, 23 insertions(+), 20 deletions(-) delete mode 100644 webapp/Dockerfile create mode 100644 webapp/go/Dockerfile diff --git a/docker-compose.yml b/docker-compose.yml index 04162727..290d0ff6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,7 +15,7 @@ services: webapp: cpus: 1 mem_limit: 1g - build: ./webapp/ + build: ./webapp/go environment: ISUCON_DB_HOST: mysql ISUCON_DB_PORT: 3306 @@ -50,7 +50,7 @@ services: restart: always blackauth: - build: ./webapp + build: ./webapp/go ports: - "3001:3001" init: true @@ -64,7 +64,7 @@ services: - main.go bench: - build: ./webapp + build: ./webapp/go stdin_open: true tty: true environment: diff --git a/webapp/Dockerfile b/webapp/Dockerfile deleted file mode 100644 index 768c0753..00000000 --- a/webapp/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -FROM ubuntu:22.04 - -ENV GO_VERSION 1.18.3 -ARG TARGETOS TARGETARCH -RUN apt-get update && apt-get -y upgrade && apt-get install -y wget gcc g++ make mysql-client-8.0 sqlite3 -RUN wget -q https://go.dev/dl/go${GO_VERSION}.${TARGETOS}-${TARGETARCH}.tar.gz && \ - tar -C /usr/local -xzf go${GO_VERSION}.${TARGETOS}-${TARGETARCH}.tar.gz && \ - rm go${GO_VERSION}.${TARGETOS}-${TARGETARCH}.tar.gz - -RUN mkdir -p /home/isucon/webapp/go -WORKDIR /home/isucon/webapp/go - -ENV GOPATH /home/isucon/go -ENV PATH /home/isucon/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin -RUN go install github.com/cespare/reflex@latest - -CMD [ "reflex", "-r", "(\\.go$|go\\.mod)", "-s", "go", "run", "cmd/isuports/main.go" ] diff --git a/webapp/go/Dockerfile b/webapp/go/Dockerfile new file mode 100644 index 00000000..ae0366ae --- /dev/null +++ b/webapp/go/Dockerfile @@ -0,0 +1,20 @@ +FROM golang:1.18.3-bullseye + +WORKDIR /tmp +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update && \ + apt-get -y upgrade && \ + apt-get install -y wget gcc g++ make sqlite3 && \ + wget -q https://dev.mysql.com/get/mysql-apt-config_0.8.22-1_all.deb && \ + apt-get -y install ./mysql-apt-config_*_all.deb && \ + apt-get -y update && \ + apt-get -y install mysql-client + +RUN mkdir -p /home/isucon/webapp/go +WORKDIR /home/isucon/webapp/go + +ENV GOPATH /home/isucon/go +ENV PATH /home/isucon/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +RUN go install github.com/cespare/reflex@latest + +CMD [ "reflex", "-r", "(\\.go$|go\\.mod)", "-s", "go", "run", "cmd/isuports/main.go" ]