TD-6: Replace rbkmoney build image with common one (#4)

* TD-6: Decouple from rbkmoney build image

* Add env variables to build CI

* Fix image name

* Try to fix arg

* Import .env in Makefile

* Add args to docker step

* Fix build-args format

* Fix typo

* Add setup buildx to CI
This commit is contained in:
ndiezel0 2022-02-01 13:30:52 +03:00 committed by GitHub
parent 7c026e2973
commit 8bd7828fc0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 8 deletions

5
.env
View File

@ -2,6 +2,5 @@
# You SHOULD specify point releases here so that build time and run time Erlang/OTPs
# are the same. See: https://github.com/erlware/relx/pull/902
ERLANG_VERSION=24.2.0
THRIFT_VERSION=0.14.2.1
DOCKER_BUILDKIT=1
THRIFT_VERSION=0.14.2.2
SERVICE=dominant

View File

@ -31,9 +31,20 @@ jobs:
tags: |
type=sha
# https://docs.github.com/en/actions/learn-github-actions/workflow-commands-for-github-actions#setting-an-environment-variable
- name: Update environment variables
run: grep -v '^#' .env >> $GITHUB_ENV
- name: Setup Buildx
uses: docker/setup-buildx-action@v1
- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
push: ${{ github.event_name == 'push' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
ERLANG_VERSION=${{ env.ERLANG_VERSION }}
THRIFT_VERSION=${{ env.THRIFT_VERSION }}
SERVICE=${{ env.SERVICE }}

View File

@ -1,13 +1,20 @@
FROM ghcr.io/rbkmoney/build-erlang:785d48cbfa7e7f355300c08ba9edc6f0e78810cb AS builder
ARG ERLANG_VERSION
FROM erlang:${ERLANG_VERSION} AS builder
ARG THRIFT_VERSION
ARG BUILDARCH
RUN wget -q -O- "https://github.com/valitydev/thrift/releases/download/${THRIFT_VERSION}/thrift-${THRIFT_VERSION}-linux-${BUILDARCH}.tar.gz" \
| tar -xvz -C /usr/local/bin/
RUN mkdir /build
COPY . /build/
WORKDIR /build
RUN rebar3 compile
RUN rebar3 as prod release
# Keep in sync with Erlang/OTP version in build image
FROM erlang:24.1.3.0-slim
ENV SERVICE=dominant
FROM erlang:${ERLANG_VERSION}-slim
ARG SERVICE
ENV CHARSET=UTF-8
ENV LANG=C.UTF-8
COPY --from=builder /build/_build/prod/rel/${SERVICE} /opt/${SERVICE}

View File

@ -3,7 +3,7 @@
# For example, to run with podman put `DOCKER=podman` there.
-include Makefile.env
SERVICE := dominant
-include .env
# NOTE
# Variables specified in `.env` file are used to pick and setup specific