Skip to content
This repository has been archived by the owner on Jun 24, 2023. It is now read-only.

Commit

Permalink
change code to dynamic
Browse files Browse the repository at this point in the history
  • Loading branch information
fanchann committed Apr 24, 2023
1 parent 8d0cb89 commit 389c594
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 11 deletions.
17 changes: 10 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
#this for testing!

FROM golang:latest

ENV DB_DRIVER=mysql
ENV DB_AUTH_USERNAME=
ENV DB_AUTH_PASSWORD=root
ENV DB_NAME=information_schema
ENV DB_URL=0.tcp.ap.ngrok.io
ENV DB_PORT=11376

ENV DB_DRIVER=$DB_DRIVER
ENV DB_AUTH_USERNAME=$DB_AUTH_USERNAME
ENV DB_AUTH_PASSWORD=$DB_AUTH_PASSWORD
ENV DB_NAME=$DB_NAME
ENV DB_URL=$DB_URL
ENV DB_PORT=$DB_PORT

WORKDIR /app
COPY . .
Expand All @@ -16,6 +19,6 @@ RUN mv go-start /bin/


WORKDIR /tests
RUN go-start -pkg=fanchann/api
RUN go-start -pkg=awesome/api
RUN go mod download
CMD [ "go","run","main.go" ]
6 changes: 5 additions & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
# this for testing!
version: "3.8"

services:
go-start:
container_name: go-start
image: "go-start:2.0.0"
restart: on-failure
depends_on:
- mysql_db
build:
context: "."
dockerfile: Dockerfile
environment:
DB_DRIVER: mysql
DB_AUTH_USERNAME:
DB_AUTH_USERNAME: root
DB_AUTH_PASSWORD: root
DB_NAME: information_schema
DB_URL: 0.tcp.ap.ngrok.io
Expand Down
4 changes: 2 additions & 2 deletions entity/codes/main_code.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ const (
MainCode = `package main
import (
"{{.PackageName}}/insfrastructure/database"
"{{.PackageName}}/insfrastructure/utils"
"{{.PackageName}}/infrastructure/database"
"{{.PackageName}}/infrastructure/utils"
"fmt"
)
Expand Down
2 changes: 1 addition & 1 deletion entity/codes/mysql_code.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const (
import (
"database/sql"
"fanchann/api/insfrastructure/environments"
"{{.PackageName}}/infrastructure/environments"
"fmt"
"time"
Expand Down
Binary file removed img/folder.png
Binary file not shown.
Binary file removed img/quickstart.png
Binary file not shown.

0 comments on commit 389c594

Please sign in to comment.