Skip to content

Commit

Permalink
Merge pull request #16 from whywaita/feat/add-dockerfile
Browse files Browse the repository at this point in the history
add Dockerfile
  • Loading branch information
whywaita authored Feb 2, 2021
2 parents 1140db4 + 449aa3c commit a31f551
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 4 deletions.
16 changes: 15 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,18 @@ jobs:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
github-packages:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build container image
uses: docker/build-push-action@v1
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: docker.pkg.github.com
repository: ${{ github.repository }}/myshoes
tag_with_sha: true
tag_with_ref: true
15 changes: 12 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ jobs:
- ubuntu-18.04
steps:
- name: setup go
uses: actions/setup-go@v1
uses: actions/setup-go@v2
with:
go-version: 1.x
- name: checkout
uses: actions/checkout@v1
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: lint
Expand All @@ -32,4 +32,13 @@ jobs:
go vet ./...
- name: test
run: |
make test
make test
docker-build-test:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: docker build
run: docker build .
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM golang:1.15 AS builder

WORKDIR /go/src/github.com/whywaita/myshoes

ENV CGO_ENABLED=0
ENV GOOS=linux
ENV GOARCH=amd64

RUN go get -u google.golang.org/grpc \
&& go get -u github.com/rakyll/statik \
&& go get -u github.com/golang/protobuf/protoc-gen-go
RUN apt-get update -y \
&& apt-get install -y protobuf-compiler

COPY . .
RUN make build-linux

FROM alpine

RUN apk update \
&& apk update
RUN apk add --no-cache ca-certificates \
&& update-ca-certificates 2>/dev/null || true

COPY --from=builder /go/src/github.com/whywaita/myshoes/myshoes-linux-amd64 /app

CMD ["/app"]

0 comments on commit a31f551

Please sign in to comment.