Skip to content

Commit

Permalink
Support Docker (still have bug)
Browse files Browse the repository at this point in the history
  • Loading branch information
H1rono committed Jun 14, 2022
1 parent 15c41c6 commit c172d23
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM golang:1.17-alpine AS build

WORKDIR /go/src/github.com/hackathon-22-spring-16/backend
COPY . .

RUN apk upgrade --update && \
apk --no-cache add git

RUN go mod tidy

# usermodなどで手元のUIDが変わっている場合は.envに記述する
# RUN chown -R ${UID:-1000}:${GID:-1000} ./

RUN go run main.go
30 changes: 30 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: '3'

services:
server:
build:
context: ./
dockerfile: ./Dockerfile
restart: always
environment:
PORT: ${PORT}
MARIADB_HOSTNAME: backend-mariadb-1
volumes:
- ./:/go/src/github.com/hackathon-22-spring-16/backend
expose:
- "80"
- "6060"
ports:
- "3000:3000"
depends_on:
- mariadb

mariadb:
image: mariadb:latest
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: 22hack16
command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_general_ci
volumes:
- ./mysql/data:/var/lib/mysql:z
- ./mysql/init:/docker-entrypoint-initdb.d:z

0 comments on commit c172d23

Please sign in to comment.