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

Create memo app #1

Merged
merged 4 commits into from
Sep 29, 2019
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
docker-compose.yml
breath.yml
*.yml
*.conf
elm-stuff
9 changes: 9 additions & 0 deletions docker/memo_app/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

develop: docker-compose-develop.yml
docker-compose -f docker-compose-develop.yml up --build

release: docker-compose.yml
docker-compose -f docker-compose.yml up --build

sh:
docker run -it memo_app_api_server /bin/ash
12 changes: 12 additions & 0 deletions docker/memo_app/api_server/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM golang:alpine

USER root

COPY ./go/src/memo_app /go/src/memo_app
WORKDIR /go/src/memo_app
RUN go build -o main
RUN mkdir /app \
&& cp /go/src/memo_app/main /app/main

WORKDIR /
CMD ./app/main
3 changes: 3 additions & 0 deletions docker/memo_app/api_server/go/src/memo_app/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/wsuzume/base_project/memo_app

go 1.13
7 changes: 7 additions & 0 deletions docker/memo_app/api_server/go/src/memo_app/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package main


func main() {
println("Hello, world!!")
return
}
42 changes: 42 additions & 0 deletions docker/memo_app/docker-compose-develop.breath
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
version: "3"

services:
memo_app_mysql:
build: mysql
container_name: memo_app_mysql
environment:
MYSQL_ROOT_PASSWORD: {{{MYSQL_ROOT_PASSWORD}}}
MYSQL_DATABASE: {{{MYSQL_DATABASE}}}
MYSQL_USER: {{{MYSQL_USER}}}
MYSQL_PASSWORD: {{{MYSQL_PASSWORD}}}
TZ: 'Asia/Tokyo'
command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
volumes:
- ./mysql/data:/var/lib/mysql
- ./mysql/conf.d:/etc/mysql
- ./mysql/initdb.d:/docker-entrypoint-initdb.d
ports:
- 3306:3306

memo_app_redis:
build: redis
ports:
- "6379:6379"
volumes:
- "./redis/data:/data"
sysctls:
- net.core.somaxconn=1024
# This setting can be enabled if Docker host's global kernel parameter is vm.overcomiit_memory=1
# Consider `sysctl vm.overcommit_memory=1 on your host.`
# - vm.overcommit_memory=1

api_server:
build: api_server
depends_on:
- memo_app_mysql
- memo_app_redis
volumes:
- ./api_server/go/src/memo_app:/go/src/memo_app
ports:
- "8080:8080"

6 changes: 6 additions & 0 deletions docker/memo_app/mysql/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM mysql:8.0.17

# VOLUME としてマウントしているので以下の chmod は動作しない
# Warning を消すには必要なので後で対応を考える
#RUN mkdir -p /var/lib/mysql
#RUN chmod 770 /var/lib/mysql
3 changes: 3 additions & 0 deletions docker/memo_app/mysql/conf.d/my.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[mysqld]
datadir=/var/lib/mysql
secure_file_priv=/var/lib/mysql