-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: build container on release (#396)
* new (CI): optimized Dockerfile; labeled Dockerfile; Github Action to build container; edit docker-compose * new (CI): rename secrets * CI: edit registry name * CI: edit registry namespace * CI: do repeat yourself in GHA * CI: fix maintainers; debug version tag * CI: add rpc to env file * CI: build the same image in parallel, what a joke * CI: fix matrix * CI: debug matrix * CI: debug matrix 2 * CI: according to doc this should work * CI: proudly move it to parity namespace * CI: add docker pull to README
- Loading branch information
1 parent
43a8137
commit ed52edd
Showing
5 changed files
with
86 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: Build and Publish container for new releases | ||
|
||
on: | ||
release: | ||
types: | ||
- published | ||
|
||
jobs: | ||
build: | ||
name: Build and push image | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
# this matrix runs the jobs twice, in parallel. This is due to | ||
# both buildah actions can't manage more than one image tag. | ||
tag: | ||
- latest | ||
- ${{ github.event.release.tag_name }} | ||
env: | ||
REGISTRY: docker.io/parity | ||
IMAGE_NAME: substrate-api-sidecar | ||
VERSION: ${{ github.event.release.tag_name }} | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Build Image tagged ${{ matrix.tag }} | ||
uses: redhat-actions/buildah-build@v1 | ||
with: | ||
image: ${{ env.IMAGE_NAME }} | ||
tag: ${{ matrix.tag }} | ||
dockerfiles: | | ||
./Dockerfile | ||
build-args: | | ||
VERSION=${{ env.VERSION }} | ||
VCS_REF=${{ github.ref }} | ||
BUILD_DATE=${{ github.event.release.published_at }} | ||
- name: Push image tagged ${{ matrix.tag }} to docker.io | ||
id: push-to-dockerhub | ||
uses: redhat-actions/push-to-registry@v1 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
image: ${{ env.IMAGE_NAME }} | ||
tag: ${{ matrix.tag }} | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Check the image | ||
run: | | ||
echo "New image has been pushed to ${{ steps.push-to-dockerhub.outputs.registry-path }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,34 @@ | ||
FROM node:15 as builder | ||
LABEL author="[email protected]" | ||
FROM docker.io/library/node:15 as builder | ||
|
||
WORKDIR /opt/builder | ||
|
||
COPY . . | ||
RUN curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh -s -- -y && \ | ||
. $HOME/.cargo/env && \ | ||
cargo install wasm-pack && \ | ||
yarn install && \ | ||
|
||
RUN yarn install && \ | ||
yarn build | ||
|
||
# --------------------------------- | ||
|
||
FROM node:15-alpine | ||
FROM docker.io/library/node:15-alpine | ||
|
||
# metadata | ||
ARG VERSION="" | ||
ARG VCS_REF=master | ||
ARG BUILD_DATE="" | ||
|
||
LABEL summary="Substrate-api-sidecar." \ | ||
name="parity/substrate-api-sidecar" \ | ||
maintainer="[email protected], [email protected]" \ | ||
version="${VERSION}" \ | ||
description="Substrate-api-sidecar image." \ | ||
io.parity.image.vendor="Parity Technologies" \ | ||
io.parity.image.source="https://github.com/paritytech/substrate-api-sidecar/blob/\ | ||
${VCS_REF}/Dockerfile" \ | ||
io.parity.image.documentation="https://github.com/paritytech/substrate-api-sidecar/\ | ||
blob/${VCS_REF}/README.md" \ | ||
io.parity.image.revision="${VCS_REF}" \ | ||
io.parity.image.created="${BUILD_DATE}" | ||
|
||
WORKDIR /usr/src/app | ||
|
||
COPY --from=builder /opt/builder /usr/src/app | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters