Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docker build to PR builds; fix paths in Dockerfile #122

Merged
merged 2 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,30 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.21"
go-version: '1.21'
check-latest: true

- name: Build and Test
run: make

- name: Upload coverage
run: bash <(curl -s https://codecov.io/bash)
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set build tag
id: build_tag_generator
run: |
RELEASE_TAG=$(curl https://api.github.com/repos/hyperledger/firefly-fabconnect/releases/latest -s | jq .tag_name -r)
BUILD_TAG=$RELEASE_TAG-$(date +"%Y%m%d")-$GITHUB_RUN_NUMBER
echo ::set-output name=BUILD_TAG::$BUILD_TAG

- name: Build
run: |
docker build \
--label commit=$GITHUB_SHA \
--label build_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
--label tag=${{ steps.build_tag_generator.outputs.BUILD_TAG }} \
--tag ghcr.io/hyperledger/firefly-fabconnect:${{ steps.build_tag_generator.outputs.BUILD_TAG }} .
8 changes: 2 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
FROM golang:1.21-alpine3.19 AS fabconnect-builder
RUN apk add make
ADD --chown=1001:0 . /fabconnect
ADD . /fabconnect
WORKDIR /fabconnect
RUN mkdir /.cache \
&& chgrp -R 0 /.cache \
&& chmod -R g+rwX /.cache
USER 1001
RUN make

FROM alpine:3.19
WORKDIR /fabconnect
COPY --from=fabconnect-builder --chown=1001:0 /fabconnect/fabconnect ./
COPY --from=fabconnect-builder /fabconnect/fabconnect ./
ADD ./openapi ./openapi/
RUN ln -s /fabconnect/fabconnect /usr/bin/fabconnect
RUN chgrp -R 0 /openapi && \
chmod -R g+rwX /openapi
USER 1001
ENTRYPOINT [ "fabconnect" ]
Loading