diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml new file mode 100644 index 0000000..53676ef --- /dev/null +++ b/.github/workflows/docker-build.yml @@ -0,0 +1,49 @@ +name: Docker Build + +on: + push: + branches: + - 'master' + release: + types: [released] + pull_request: + types: [opened, synchronize, reopened] + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v2 + - + name: Docker meta + id: meta + uses: docker/metadata-action@v3 + with: + images: humanmade/tachyon + tags: | + type=edge,branch=master + type=ref,event=tag + type=ref,event=pr + - + name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - + name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - + name: Build and push latest + uses: docker/build-push-action@v2 + with: + file: Dockerfile.multiarch + context: . + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ steps.meta.outputs.tags }} diff --git a/Dockerfile.multiarch b/Dockerfile.multiarch new file mode 100644 index 0000000..3baa998 --- /dev/null +++ b/Dockerfile.multiarch @@ -0,0 +1,30 @@ +FROM node:14-alpine + +# Install build base +RUN apk --update add --no-cache \ + # --repository https://dl-cdn.alpinelinux.org/alpine/edge/community \ + --virtual build-deps fftw-dev gcc g++ make libc6-compat python +RUN apk --update add --no-cache \ + # --repository https://dl-cdn.alpinelinux.org/alpine/edge/community \ + vips-dev + +# Get app +COPY ./ /srv/tachyon/ +WORKDIR /srv/tachyon +RUN rm -rf node_modules +RUN npm install aws-sdk +RUN npm install --production + +# Clean up +RUN apk del build-deps + +# Enable env vars +ARG AWS_REGION +ARG AWS_S3_BUCKET +ARG AWS_S3_ENDPOINT +ARG PORT +ARG DEBUG=0 + +# Start the server +EXPOSE ${PORT:-8080} +CMD (($DEBUG)) && node server.js ${PORT:-8080} --debug || node server.js ${PORT:-8080}