-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #97 from isucon/feature/development-docker
developmentディレクトリ以下に各言語実装に対応したMakefileなどを入れた
- Loading branch information
Showing
4 changed files
with
142 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
.PHONY: install-initialdata init-mysql run-bench run-bench-noload | ||
|
||
up/%: | ||
docker compose -f docker-compose-$*.yml -f docker-compose-common.yml up -d | ||
|
||
down/%: | ||
docker compose -f docker-compose-$*.yml -f docker-compose-common.yml down -d | ||
|
||
logs-webapp/%: | ||
docker compose -f docker-compose-$*.yml -f docker-compose-common.yml logs -f webapp | ||
|
||
install-initialdata: | ||
docker compose -f docker-compose-common.yml cp ../initial_data/ bench:/home/isucon/ | ||
|
||
init-mysql: | ||
docker compose -f docker-compose-common.yml exec --workdir /docker-entrypoint-initdb.d mysql \ | ||
bash -c 'cat 10_schema.sql 90_data.sql | mysql -uisucon -pisucon isuports' | ||
|
||
run-bench: | ||
docker compose -f docker-compose-common.yml exec bench ./run_local.sh | ||
|
||
run-bench-noload: | ||
docker compose -f docker-compose-common.yml exec bench ./run_local.sh -prepare-only |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
version: '3.0' | ||
|
||
services: | ||
nginx: | ||
image: nginx:1.22 | ||
volumes: | ||
- ../nginx/conf.d:/etc/nginx/conf.d | ||
- ../nginx/tls:/etc/nginx/tls | ||
#- ./public:/public | ||
ports: | ||
- "443:443" | ||
network_mode: host | ||
restart: always | ||
|
||
mysql: | ||
cpus: 1 | ||
mem_limit: 1g | ||
image: mysql/mysql-server:8.0.29 | ||
environment: | ||
- "MYSQL_ROOT_HOST=%" | ||
- "MYSQL_ROOT_PASSWORD=root" | ||
volumes: | ||
- ../webapp/sql/admin/:/docker-entrypoint-initdb.d | ||
- mysql:/var/lib/mysql | ||
ports: | ||
- 13306:3306 | ||
restart: always | ||
|
||
blackauth: | ||
build: | ||
context: ../ | ||
dockerfile: ./development/backend-go/Dockerfile | ||
ports: | ||
- "3001:3001" | ||
init: true | ||
restart: always | ||
volumes: | ||
- ../:/home/isucon | ||
working_dir: /home/isucon/blackauth | ||
command: | ||
- /usr/local/go/bin/go | ||
- run | ||
- main.go | ||
|
||
bench: | ||
build: ../webapp | ||
stdin_open: true | ||
tty: true | ||
environment: | ||
ISUCON_JWT_KEY_FILE: ./isuports.pem | ||
volumes: | ||
- ../:/home/isucon | ||
- tenant_db:/home/isucon/webapp/tenant_db | ||
- initial_data:/home/isucon/initial_data | ||
- gopkg:/home/isucon/go/pkg | ||
network_mode: host | ||
working_dir: /home/isucon/bench | ||
command: | ||
- "bash" | ||
- "-c" | ||
- "sleep infinity" | ||
|
||
volumes: | ||
mysql: | ||
gopkg: | ||
tenant_db: | ||
initial_data: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
version: '3.0' | ||
|
||
services: | ||
webapp: | ||
cpus: 1 | ||
mem_limit: 1g | ||
build: | ||
context: ../ | ||
dockerfile: ./development/backend-go/Dockerfile | ||
environment: | ||
ISUCON_DB_HOST: mysql | ||
ISUCON_DB_PORT: 3306 | ||
ISUCON_DB_USER: isucon | ||
ISUCON_DB_PASSWORD: isucon | ||
ISUCON_DB_NAME: isuports | ||
ISUCON_ADMIN_HOSTNAME: admin.t.isucon.dev | ||
ports: | ||
- "3000:3000" | ||
links: | ||
- mysql | ||
volumes: | ||
- ../webapp:/home/isucon/webapp | ||
- tenant_db:/home/isucon/webapp/tenant_db | ||
- initial_data:/home/isucon/initial_data | ||
- gopkg:/home/isucon/go/pkg | ||
init: true | ||
restart: always | ||
|
||
volumes: | ||
gopkg: | ||
tenant_db: | ||
initial_data: |