diff --git a/.github/workflows/build-image.yaml b/.github/workflows/build-image.yaml new file mode 100644 index 0000000..0e55dbb --- /dev/null +++ b/.github/workflows/build-image.yaml @@ -0,0 +1,38 @@ +name: Build Docker image +on: + push: + branches: [master] + pull_request: + branches: ["*"] + +env: + REGISTRY: ghcr.io + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Log in to the Container registry + uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Construct tags / labels for an image + id: meta + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + with: + images: | + ${{ env.REGISTRY }}/${{ github.repository }} + tags: | + type=sha + - 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 }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 852eab1..40f9c18 100644 --- a/.gitignore +++ b/.gitignore @@ -9,8 +9,6 @@ erl_crash.dump \#* .\#* .tags* -Dockerfile -docker-compose.yml rebar3.crashdump /_checkouts/ /test/policies/bundle.tar.gz \ No newline at end of file diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 2042aca..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "build-utils"] - path = build_utils - url = git@github.com:rbkmoney/build_utils diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9908ca9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM ghcr.io/rbkmoney/build-erlang:785d48cbfa7e7f355300c08ba9edc6f0e78810cb AS builder +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=bouncer +ENV CHARSET=UTF-8 +ENV LANG=C.UTF-8 +COPY --from=builder /build/_build/prod/rel/${SERVICE} /opt/${SERVICE} +WORKDIR /opt/${SERVICE} +ENTRYPOINT [] +CMD /opt/${SERVICE}/bin/${SERVICE} foreground +EXPOSE 8022 \ No newline at end of file diff --git a/Dockerfile.sh b/Dockerfile.sh deleted file mode 100755 index a4e8218..0000000 --- a/Dockerfile.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -cat <