Skip to content

Commit

Permalink
chore: restructure repo
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesse0Michael committed Jul 6, 2020
1 parent 6f930ae commit e2d7d2b
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 16 deletions.
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
- name: Build
run: |
docker build \
-- file ./build/Dockerfile \
-t docker.pkg.github.com/jesse0michael/fetcher/api:${REF##*/} \
-t registry.heroku.com/jesse0michael-fetcher/api .
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ functions/.runtimeconfig.json
/coverage

# production
/build
/bin

# misc
Expand Down
File renamed without changes.
12 changes: 7 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.PHONY: build

gen:
docker run -v ${PWD}:/fetcher openapitools/openapi-generator-cli generate -i /fetcher/api/openapi.yaml -g go-server -o /fetcher -c /fetcher/config.json --git-user-id jesse0michael --git-repo-id jessemichael.me --enable-post-process-file -t /fetcher/.openapi-generator/templates/go-server
docker run -v ${PWD}:/fetcher openapitools/openapi-generator-cli generate -i /fetcher/api/openapi.yaml -g go-server -o /fetcher -c /fetcher/.openapi-generator/config.json --git-user-id jesse0michael --git-repo-id jessemichael.me --enable-post-process-file -t /fetcher/.openapi-generator/templates/go-server
# GO_POST_PROCESS_FILE="gofmt -w"

docker run -v ${PWD}:/fetcher openapitools/openapi-generator-cli generate -i /fetcher/api/openapi.yaml -g typescript-node -o /fetcher/client/ts/ --git-user-id jesse0michael --git-repo-id jessemichael.me --additional-properties=npmName=@jesse0michael/jessemichael.me,npmVersion=1.0.0
Expand All @@ -8,12 +10,12 @@ gen-docs:
redoc-cli bundle api/openapi.yaml -o docs/index.html --options.disableSearch --options.hideDownloadButton

build:
go build -o bin/fetcher
GOOS=linux go build -o bin/lambda pkg/lambda/main.go
go build -o bin/fetcher ./cmd/fetcher/
GOOS=linux go build -o bin/lambda ./cmd/lambda/
cd bin && zip function.zip lambda

build-docker:
docker build -t fetcher .
docker build -t fetcher --file ./build/Dockerfile .

run:
docker run -p 8080:8080 fetcher
docker run -p 8080:8080 fetcher
13 changes: 7 additions & 6 deletions Dockerfile → build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.13-alpine AS build
FROM golang:1.14-alpine AS build

# Install git + SSL ca certificates.
# Git is required for fetching the dependencies.
Expand All @@ -7,16 +7,17 @@ RUN apk update && apk add --no-cache git ca-certificates && update-ca-certificat

# Copy project files
WORKDIR /go/src
COPY . .
COPY go.mod .
COPY go.sum .
RUN mkdir /dir

# Fetch dependencies (go mod)
ENV GO111MODULE=on
# Fetch dependencies
RUN go mod download
RUN go mod verify
COPY . .

# Build project
ENV CGO_ENABLED=0
RUN go build -a -installsuffix cgo -o fetcher .
RUN go build -a -installsuffix cgo -o fetcher .cmd/fetcher

FROM scratch AS runtime

Expand Down
4 changes: 2 additions & 2 deletions main.go → cmd/fetcher/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ func main() {

// oauth2 configures a client that uses app credentials to keep a fresh token
config := &clientcredentials.Config{
ClientID: "<redacted>",
ClientSecret: "<redacted>",
ClientID: "tswH7DBOa2WbGMMBUasl8g",
ClientSecret: "htau31s5eKenDHP0e3gPbVq1krXC6kQxzvXsp20ls0",
TokenURL: "https://api.twitter.com/oauth2/token",
}
// http.Client will automatically authorize Requests
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions pkg/fetcher/routers.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* jessemichael.me internal
* Fetcher
*
* Internal workings of Jesse Michael
* Fetch social media feeds
*
* API version: v1
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
Expand Down

0 comments on commit e2d7d2b

Please sign in to comment.