Skip to content

Commit

Permalink
tmp: tmptmptmp
Browse files Browse the repository at this point in the history
fin: build check
  • Loading branch information
archmagece committed Jul 18, 2024
1 parent 99e8227 commit 2f75a11
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 38 deletions.
4 changes: 3 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
.idea/
.env
README.md
.env_defaultn
.env_defaultn

#main
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

# go
vendor/
/main

# test
tmp/

21 changes: 14 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,32 @@ ARG GO_VERSION=1.22
ARG APP_BUILD_DIR=/go/src/app
ARG APP_RUN_DIR=/go/src/app

ARG GID=1000
ARG UID=1000
ARG APP_USER=user01
ARG APP_GROUP=group01

FROM golang:${GO_VERSION} as builder

#ARG MYGID=1001
#ARG MYUID=1001
#ARG APP_USER=user01
#ARG APP_GROUP=group01
#ENV MYGID=${MYGID}
#ENV MYUID=${MYUID}
#ENV APP_USER=${APP_USER}
#ENV APP_GROUP=${APP_GROUP}

# for debian
#RUN groupadd --gid $GID $APP_GROUP && useradd -m -l --uid $UID --gid $GID $APP_USER
#RUN mkdir -p $APP_DIR && chown -R $APP_USER:$APP_USER $APP_DIR
# for alpine
RUN addgroup -g $GID $APP_GROUP
RUN adduser -u $UID -G $APP_GROUP $APP_USER -h $APP_DIR -D
USER $APP_USER
#RUN echo "1111111111111 ${MYGID} ${APP_GROUP}"
#RUN groupadd -g ${MYGID} -o ${APP_GROUP}
#RUN useradd -g $MYGID -o $APP_USER -u $MYUID -d /home/$APP_USER
#USER $APP_USER

WORKDIR $APP_BUILD_DIR

COPY . .
RUN go get -d -v ./...
RUN go mod download
#RUN go install -v ./...
RUN go build -o main

Expand All @@ -41,6 +47,7 @@ EXPOSE 8080

RUN apk --no-cache add ca-certificates

RUN echo $APP_BUILD_DIR $APP_RUN_DIR
WORKDIR $APP_RUN_DIR
COPY --from=builder $APP_BUILD_DIR/main .
CMD ["./main"]
19 changes: 19 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
ENV=develop
DOCKER_REGISTRY=scripton-io


build:
@echo "Building..."
docker build -t ${DOCKER_REGISTRY}/doharding:latest .

docker-run:
@echo "Running..."
docker run -it --rm golang bash
# export MYGID=1000
# export MYUID=1000
# export APP_USER=user01
# export APP_GROUP=group01
# RUN groupadd -g ${MYGID} ${APP_GROUP}
# RUN useradd -g $MYGID -o $APP_USER -u $MYUID -d /home/$APP_USER -s /bin/bash -m $APP_USER

.PHONY: build
5 changes: 0 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91
github.com/go-playground/validator/v10 v10.22.0 h1:k6HsTZ0sTnROkhS//R0O+55JgM8C4Bx7ia+JlgcnOao=
github.com/go-playground/validator/v10 v10.22.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM=
github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE=
github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpvNJ1Y=
github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg=
github.com/goccy/go-json v0.10.3 h1:KZ5WoDbxAIgm2HNbYckL0se1fHD6rz5j4ywS6ebzDqA=
Expand All @@ -45,7 +43,6 @@ github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5a
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
Expand Down Expand Up @@ -133,8 +130,6 @@ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8
gopkg.in/testfixtures.v2 v2.6.0 h1:j5opJyoW6CCx46qGQHvfoY6k1XK5/KhWecuL7MpMWZg=
gopkg.in/testfixtures.v2 v2.6.0/go.mod h1:rGPtsOtPcZhs7AsHYf1WmufW1hEsM6DXdLrYz60nrQQ=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
Expand Down
2 changes: 0 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@ import (
"os"
)

//Execution starts from main function
func main() {
e := godotenv.Load()
if e != nil {
fmt.Print(e)
}

r := routers.SetupRouter()
routers.MirrorRouter(r)
routers.ProxyRouter(r)

port := os.Getenv("port")
Expand Down
23 changes: 0 additions & 23 deletions routers/mirror_router.go

This file was deleted.

0 comments on commit 2f75a11

Please sign in to comment.