Skip to content

Commit

Permalink
Use buildx functions for faster build
Browse files Browse the repository at this point in the history
  • Loading branch information
inductor committed Nov 15, 2022
1 parent f32c2de commit f4f6797
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/build-image.yml
Expand Up @@ -40,7 +40,8 @@ jobs:
with:
context: .
platforms: linux/amd64,linux/arm64
builder: ${{ steps.buildx.outputs.name }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=registry,ref=tootsuite/mastodon:edge
cache-to: type=inline
cache-from: type=gha
cache-to: type=gha,mode=max
7 changes: 4 additions & 3 deletions Dockerfile
@@ -1,3 +1,4 @@
# syntax=docker/dockerfile:1.4
FROM ubuntu:20.04 as build-dep

# Use bash for the shell
Expand Down Expand Up @@ -65,8 +66,8 @@ RUN cd /opt/mastodon && \
FROM ubuntu:20.04

# Copy over all the langs needed for runtime
COPY --from=build-dep /opt/node /opt/node
COPY --from=build-dep /opt/ruby /opt/ruby
COPY --from=build-dep --link /opt/node /opt/node
COPY --from=build-dep --link /opt/ruby /opt/ruby

# Add more PATHs to the PATH
ENV PATH="${PATH}:/opt/ruby/bin:/opt/node/bin:/opt/mastodon/bin"
Expand Down Expand Up @@ -97,7 +98,7 @@ RUN apt-get update && \

# Copy over mastodon source, and dependencies from building, and set permissions
COPY --chown=mastodon:mastodon . /opt/mastodon
COPY --from=build-dep --chown=mastodon:mastodon /opt/mastodon /opt/mastodon
COPY --from=build-dep --link --chown=mastodon:mastodon /opt/mastodon /opt/mastodon

# Run mastodon services in prod mode
ENV RAILS_ENV="production"
Expand Down

0 comments on commit f4f6797

Please sign in to comment.