From f130e120fb44a0b7c8e71732c6b4ce1d409848f5 Mon Sep 17 00:00:00 2001 From: Kichiyaki Date: Fri, 12 Nov 2021 17:37:43 +0100 Subject: [PATCH] move main.go to /cmd/api and Dockerfile to /build/api --- .github/workflows/publish.yml | 2 +- README.md | 13 ++----------- Dockerfile => build/api/Dockerfile | 2 +- main.go => cmd/api/main.go | 0 4 files changed, 4 insertions(+), 13 deletions(-) rename Dockerfile => build/api/Dockerfile (99%) rename main.go => cmd/api/main.go (100%) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 6af1bd7..7f811f7 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -43,5 +43,5 @@ jobs: tags: | ${{ secrets.REGISTRY_NAME }}/twhelp-api:latest ${{ secrets.REGISTRY_NAME }}/twhelp-api:${{ steps.get_version.outputs.VERSION }} - file: ./Dockerfile + file: ./build/server/Dockerfile push: true diff --git a/README.md b/README.md index 0857a73..a6df9c2 100644 --- a/README.md +++ b/README.md @@ -133,19 +133,10 @@ LOG_DB_QUERIES=true DISABLE_ACCESS_LOG=false ``` -1. Clone this repo. - -``` -git clone git@github.com:tribalwarshelp/api.git -``` - +1. Clone this repo - ``git clone git@github.com:tribalwarshelp/api.git`` 2. Open the folder with this project in a terminal. 3. Set the required env variables directly in your system or create .env.local file. -4. Run the app. - -``` -go run main.go -``` +4. Run the app - ``go run ./cmd/api/main.go`` ## License diff --git a/Dockerfile b/build/api/Dockerfile similarity index 99% rename from Dockerfile rename to build/api/Dockerfile index 23d40ae..7446ea9 100644 --- a/Dockerfile +++ b/build/api/Dockerfile @@ -15,7 +15,7 @@ ARG VERSION="0.0.0" RUN apk --no-cache add musl-dev gcc build-base RUN go install github.com/99designs/gqlgen@v0.14.0 RUN go generate ./... -RUN go build -ldflags="-X 'main.Version=$VERSION'" -o twhelpapi . +RUN go build -ldflags="-X 'main.Version=$VERSION'" -o twhelpapi ./cmd/api ######## Start a new stage from scratch ####### FROM alpine:latest diff --git a/main.go b/cmd/api/main.go similarity index 100% rename from main.go rename to cmd/api/main.go