diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..6853c0e --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,38 @@ +name: Build Container + +on: push + +jobs: + build-and-push: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Build Container + id: build-container + uses: redhat-actions/buildah-build@v2 + with: + image: spotify-proxy + tags: v1 ${{ github.sha }} + context: ./spotify_proxy + containerfiles: | + ./spotify_proxy/Containerfile + + - name: Log in to ghcr.io + uses: redhat-actions/podman-login@v1 + with: + username: ${{ github.actor }} + password: ${{ github.token }} + registry: ghcr.io/${{ github.repository_owner }} + + - name: Push to ghcr.io + uses: redhat-actions/push-to-registry@v2 + with: + image: ${{ steps.build-container.outputs.image }} + tags: ${{ steps.build-container.outputs.tags }} + registry: ghcr.io/${{ github.repository_owner }} diff --git a/spotify_proxy/Containerfile b/spotify_proxy/Containerfile new file mode 100644 index 0000000..fcc910d --- /dev/null +++ b/spotify_proxy/Containerfile @@ -0,0 +1,14 @@ +FROM erlang:28.1.0.0-alpine AS build +COPY --from=ghcr.io/gleam-lang/gleam:v1.12.0-erlang-alpine /bin/gleam /bin/gleam +COPY . /app/ +RUN cd /app && gleam export erlang-shipment + +FROM erlang:28.1.0.0-alpine +RUN \ + addgroup --system webapp && \ + adduser --system webapp -g webapp +USER webapp +COPY --from=build /app/build/erlang-shipment /app +WORKDIR /app +ENTRYPOINT ["/app/entrypoint.sh"] +CMD ["run"]