Add version suffixes to nightly & edge image builds (#24823)
This commit is contained in:
		
							parent
							
								
									569b39256b
								
							
						
					
					
						commit
						830e6cefae
					
				
							
								
								
									
										7
									
								
								.github/workflows/build-image.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								.github/workflows/build-image.yml
									
									
									
									
										vendored
									
									
								
							@ -57,9 +57,16 @@ jobs:
 | 
				
			|||||||
            type=pep440,pattern=v{{major}}.{{minor}}
 | 
					            type=pep440,pattern=v{{major}}.{{minor}}
 | 
				
			||||||
            type=ref,event=pr
 | 
					            type=ref,event=pr
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      - name: Generate version suffix
 | 
				
			||||||
 | 
					        id: version_vars
 | 
				
			||||||
 | 
					        if: github.repository == 'mastodon/mastodon' && github.event_name == 'push' && github.ref_name == 'main'
 | 
				
			||||||
 | 
					        run: |
 | 
				
			||||||
 | 
					          echo mastodon_version_suffix=\"+edge-$(git rev-parse --short HEAD)\" >> $GITHUB_OUTPUT
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      - uses: docker/build-push-action@v4
 | 
					      - uses: docker/build-push-action@v4
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          context: .
 | 
					          context: .
 | 
				
			||||||
 | 
					          build-args: MASTODON_VERSION_SUFFIX=${{ steps.version_vars.outputs.mastodon_version_suffix }}
 | 
				
			||||||
          platforms: linux/amd64,linux/arm64
 | 
					          platforms: linux/amd64,linux/arm64
 | 
				
			||||||
          provenance: false
 | 
					          provenance: false
 | 
				
			||||||
          builder: ${{ steps.buildx.outputs.name }}
 | 
					          builder: ${{ steps.buildx.outputs.name }}
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										6
									
								
								.github/workflows/build-nightly.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								.github/workflows/build-nightly.yml
									
									
									
									
										vendored
									
									
								
							@ -41,9 +41,15 @@ jobs:
 | 
				
			|||||||
          labels: |
 | 
					          labels: |
 | 
				
			||||||
            org.opencontainers.image.description=Nightly build image used for testing purposes
 | 
					            org.opencontainers.image.description=Nightly build image used for testing purposes
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      - name: Generate version suffix
 | 
				
			||||||
 | 
					        id: version_vars
 | 
				
			||||||
 | 
					        run: |
 | 
				
			||||||
 | 
					          echo mastodon_version_suffix=\"+nightly-$(date +'%Y%m%d')\" >> $GITHUB_OUTPUT
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      - uses: docker/build-push-action@v4
 | 
					      - uses: docker/build-push-action@v4
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          context: .
 | 
					          context: .
 | 
				
			||||||
 | 
					          build-args: MASTODON_VERSION_SUFFIX=${{ steps.version_vars.outputs.mastodon_version_suffix }}
 | 
				
			||||||
          platforms: linux/amd64,linux/arm64
 | 
					          platforms: linux/amd64,linux/arm64
 | 
				
			||||||
          provenance: false
 | 
					          provenance: false
 | 
				
			||||||
          builder: ${{ steps.buildx.outputs.name }}
 | 
					          builder: ${{ steps.buildx.outputs.name }}
 | 
				
			||||||
 | 
				
			|||||||
@ -2,6 +2,10 @@
 | 
				
			|||||||
# This needs to be bullseye-slim because the Ruby image is built on bullseye-slim
 | 
					# This needs to be bullseye-slim because the Ruby image is built on bullseye-slim
 | 
				
			||||||
ARG NODE_VERSION="16.20-bullseye-slim"
 | 
					ARG NODE_VERSION="16.20-bullseye-slim"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Use those args to specify your own version flags & suffixes
 | 
				
			||||||
 | 
					ARG MASTODON_VERSION_FLAGS=""
 | 
				
			||||||
 | 
					ARG MASTODON_VERSION_SUFFIX=""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
FROM ghcr.io/moritzheiber/ruby-jemalloc:3.2.2-slim as ruby
 | 
					FROM ghcr.io/moritzheiber/ruby-jemalloc:3.2.2-slim as ruby
 | 
				
			||||||
FROM node:${NODE_VERSION} as build
 | 
					FROM node:${NODE_VERSION} as build
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -84,7 +88,9 @@ COPY --chown=mastodon:mastodon --from=build /opt/mastodon /opt/mastodon
 | 
				
			|||||||
ENV RAILS_ENV="production" \
 | 
					ENV RAILS_ENV="production" \
 | 
				
			||||||
    NODE_ENV="production" \
 | 
					    NODE_ENV="production" \
 | 
				
			||||||
    RAILS_SERVE_STATIC_FILES="true" \
 | 
					    RAILS_SERVE_STATIC_FILES="true" \
 | 
				
			||||||
    BIND="0.0.0.0"
 | 
					    BIND="0.0.0.0" \
 | 
				
			||||||
 | 
					    MASTODON_VERSION_FLAGS="${MASTODON_VERSION_FLAGS}" \
 | 
				
			||||||
 | 
					    MASTODON_VERSION_SUFFIX="${MASTODON_VERSION_SUFFIX}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Set the run user
 | 
					# Set the run user
 | 
				
			||||||
USER mastodon
 | 
					USER mastodon
 | 
				
			||||||
 | 
				
			|||||||
@ -17,11 +17,11 @@ module Mastodon
 | 
				
			|||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def flags
 | 
					    def flags
 | 
				
			||||||
      ''
 | 
					      ENV.fetch('MASTODON_VERSION_FLAGS', '')
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def suffix
 | 
					    def suffix
 | 
				
			||||||
      ''
 | 
					      ENV.fetch('MASTODON_VERSION_SUFFIX', '')
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def to_a
 | 
					    def to_a
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user