Skip to content

Commit

Permalink
Merge pull request #8 from yuminn-k/feat/docker-setup
Browse files Browse the repository at this point in the history
  • Loading branch information
yuminn-k authored Feb 11, 2024
2 parents f1ae541 + 10a1018 commit a82c286
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 0 deletions.
29 changes: 29 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
version: '3'

services:
go:
container_name: go
build: docker/go/
ports:
- "8080:8080"
links:
- mysql
# - redis
tty:
true
volumes:
- ./:/app
working_dir: /app
mysql:
container_name: mysql
build: ./docker/mysql/
hostname: mysql
ports:
- "3306:3306"
env_file:
- docker/mysql/env
command: mysqld --character-set-server=utf8 --collation-server=utf8_unicode_ci
volumes:
- "./mysql_data/mysql:/var/lib/mysql"
- "./docker/mysql/my.conf:/etc/mysql/my.conf"
- "./docker/mysql/init/:/docker-entrypoint-initdb.d"
13 changes: 13 additions & 0 deletions docker/go/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM golang:1.17-alpine3.16

COPY . /app

WORKDIR /app

RUN apk update \
&& apk add --no-cache git \
&& go get github.com/gin-gonic/[email protected] \
&& go get github.com/jinzhu/gorm \
&& go get github.com/go-sql-driver/mysql

EXPOSE 8080
4 changes: 4 additions & 0 deletions docker/mysql/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM mysql:latest

RUN chown -R mysql /var/lib/mysql && \
chgrp -R mysql /var/lib/mysql
6 changes: 6 additions & 0 deletions docker/mysql/env
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
TZ=Asia/Tokyo
MYSQL_DATABASE=minori_mysql
MYSQL_USER=minori
MYSQL_PASSWORD=minori
MYSQL_ALLOW_EMPTY_PASSWORD=yes
MYSQL_ROOT_PASSWORD=minori

0 comments on commit a82c286

Please sign in to comment.