Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
iamjooon2 committed Sep 1, 2024
1 parent 3c09af6 commit 50f4013
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ jobs:
NAME: ${{secrets.DOCKER_HUB_USERNAME}}
REPO: ${{secrets.DOCKER_HUB_REPO}}
run: |
docker build --tag $REPO .
docker tag $REPO:latest $NAME/$REPO:latest
docker push $NAME/$REPO:latest
go mod init techbloghub
docker build . -t techbloghub
docker run -p 3000:3000 techbloghub
deploy:
runs-on: self-hosted
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ jobs:

- name: Build
run: |
mkdir -p ./bin
go build -v -o ./bin/techbloghub ./...
go mod init techbloghub
docker build . -t techbloghub
docker run -p 3000:3000 techbloghub
- name: Run tests
run: go test ./...
22 changes: 15 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
FROM golang:1.22.5-alpine
FROM golang:alpine AS builder

ENV GO111MODULE=on
ENV GO125MODULE=on \
CGO_ENABLED=0 \
GOOS=linux \
GOARCH=amd64

WORKDIR /app
WORKDIR /build

COPY go.mod go.sum main.go ./

COPY go.mod go.sum ./
RUN go mod download
COPY . .

RUN go build -o main .

EXPOSE 8080
WORKDIR /dist

RUN cp /build/main .

FROM scratch

COPY --from=builder /dist/main .

CMD ["./main"]
ENTRYPOINT ["/main"]

0 comments on commit 50f4013

Please sign in to comment.