fix: enable empirica serve in docker container (#504) #67
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
name: Build Proxy | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- "cmds/proxy/**" | |
- "internal/build/**" | |
- ".github/workflows/on_push_proxy.yaml" | |
- ".github/actions/upload-empirica-cli/**" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
proxy: | |
name: Build and upload proxy | |
runs-on: ubuntu-latest | |
if: github.repository == 'empiricaly/empirica' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Get branch name | |
id: branch-name | |
uses: tj-actions/branch-names@v5.4 | |
- name: Set GITHUB_ENV | |
run: | | |
echo "BUILD_BRANCH=`echo "${{ steps.branch-name.outputs.current_branch }}" | sed -r 's,/,-,g'`" >> $GITHUB_ENV | |
echo "BUILD_TAG=${{ steps.branch-name.outputs.tag }}" >> $GITHUB_ENV | |
echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV | |
echo "BUILD_SHA=$(git rev-list -1 HEAD)" >> $GITHUB_ENV | |
echo "BUILD_SHA_SHORT=$(git rev-parse --short=7 ${{ github.sha }})" >> $GITHUB_ENV | |
echo "BUILD_NUM=${{ github.run_number }}" >> $GITHUB_ENV | |
- name: Build | |
uses: docker/build-push-action@v2 | |
with: | |
push: false | |
tags: empirica-tmp | |
file: ./build/Containerfile.proxy | |
build-args: | | |
BUILD_DATE=${{ env.BUILD_DATE }} | |
BUILD_SHA=${{ env.BUILD_SHA_SHORT }} | |
BUILD_NUM=${{ env.BUILD_NUM }} | |
BUILD_BRANCH=${{ env.BUILD_BRANCH }} | |
BUILD_TAG=${{ env.BUILD_TAG }} | |
- name: Copy binaries from image | |
run: | | |
mkdir out | |
docker run --rm empirica-tmp tar -cC /out . | tar -xC $(pwd)/out | |
- name: Upload binaries to S3 | |
uses: ./.github/actions/upload-empirica-cli | |
with: | |
bucket: empirica | |
withVariants: false | |
path: ./out | |
root: proxy | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
awsEndpoint: https://f120117e0fd797d29319953881b7634c.r2.cloudflarestorage.com | |
awsSignatureVersion: v4 |