This repository has been archived by the owner on Apr 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🚀 Created dockerfile for golang api, dockerfile for mysql db and dock…
…er-compose.
- Loading branch information
1 parent
e34d8d3
commit c52ba0c
Showing
5 changed files
with
52 additions
and
2 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,17 @@ | ||
FROM golang:1.12 | ||
|
||
WORKDIR /app | ||
|
||
COPY go.mod go.sum ./ | ||
|
||
RUN go mod download | ||
|
||
COPY . . | ||
|
||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build | ||
|
||
RUN go build -o main . | ||
|
||
EXPOSE 8080 | ||
|
||
CMD ["./main"] |
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
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,24 @@ | ||
version: '3' | ||
services: | ||
db: | ||
build: | ||
context: ./mysql | ||
environment: | ||
MYSQL_ROOT_PASSWORD: root | ||
MYSQL_DATABASE: golang_ethereum_auth | ||
MYSQL_USER: docker | ||
MYSQL_PASSWORD: docker | ||
container_name: golang_db | ||
ports: | ||
- '3306:3306' | ||
tty: true | ||
api: | ||
build: . | ||
volumes: | ||
- '.:/go' | ||
container_name: golang_api | ||
ports: | ||
- '8080:8080' | ||
tty: true | ||
depends_on: | ||
- db |
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,2 @@ | ||
FROM mysql:5.6 | ||
COPY test.sql /docker-entrypoint-initdb.d/golang_ethereum_auth.sql |
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,7 @@ | ||
USE golang_ethereum_auth; | ||
|
||
Create table `users` ( | ||
id MEDIUMINT NOT NULL AUTO_INCREMENT PRIMARY KEY, | ||
public_key VARCHAR(42) UNIQUE NOT NULL, | ||
nonce varchar(38) NOT NULL | ||
); |