-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: added docker for actions (#270)
- Loading branch information
Showing
4 changed files
with
72 additions
and
7 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,17 +20,53 @@ jobs: | |
build: | ||
needs: test | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
attestations: write | ||
id-token: write | ||
env: | ||
REGISTRY: "docker.io" | ||
IMAGE_NAME: "arigaio/atlas-action" | ||
DOCKERHUB_USERNAME: arigaio | ||
steps: | ||
- name: Install Atlas | ||
uses: ariga/setup-atlas@v0 | ||
- name: Checkout code | ||
uses: actions/[email protected] | ||
with: | ||
ref: ${{ github.event.inputs.commit || 'master' }} | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Login to Docker Hub (${{ env.REGISTRY }}) | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ env.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: | | ||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
tags: | | ||
type=ref,event=branch | ||
type=ref,event=pr | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
type=semver,pattern=v{{major}} | ||
type=sha | ||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
aws-access-key-id: ${{ secrets.RELEASE_AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.RELEASE_AWS_SECRET_ACCESS_KEY }} | ||
aws-region: us-east-1 | ||
- name: Setup Go Environment | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version-file: go.mod | ||
- name: Install Atlas | ||
uses: ariga/setup-atlas@v0 | ||
- name: Set BINARY_NAME | ||
id: set_binary_name | ||
env: | ||
|
@@ -51,15 +87,18 @@ jobs: | |
fi | ||
env: | ||
CGO_ENABLED: 0 | ||
- name: Configure AWS credentials | ||
run: | | ||
aws configure set aws_access_key_id ${{ secrets.RELEASE_AWS_ACCESS_KEY_ID }} | ||
aws configure set aws_secret_access_key ${{ secrets.RELEASE_AWS_SECRET_ACCESS_KEY }} | ||
- name: Upload binary to S3 | ||
run: | | ||
aws s3 cp ./atlas-action s3://release.ariga.io/atlas-action/$BINARY_NAME | ||
env: | ||
AWS_REGION: us-east-1 | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
labels: ${{ steps.meta.outputs.labels }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
push: true | ||
# Run end-to-end test on the published binary. | ||
e2e-test: | ||
needs: build | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Copyright 2021-present The Atlas Authors. All rights reserved. | ||
# This source code is licensed under the Apache 2.0 license found | ||
# in the LICENSE file in the root directory of this source tree. | ||
# syntax=docker/dockerfile:1 | ||
|
||
ARG ALPINE_VERSION="3.21" | ||
|
||
FROM alpine:${ALPINE_VERSION} | ||
COPY LICENSE README.md / | ||
COPY --chmod=001 ./scripts/setup-atlas.sh /usr/local/bin/setup-atlas | ||
COPY --chmod=001 ./atlas-action /usr/local/bin/ | ||
RUN apk add --update --no-cache curl | ||
RUN setup-atlas && rm -rf /root/.atlas /tmp/* | ||
WORKDIR /root | ||
VOLUME /root/.atlas | ||
ENTRYPOINT ["/usr/local/bin/atlas-action"] |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/env sh | ||
# Copyright 2021-present The Atlas Authors. All rights reserved. | ||
# This source code is licensed under the Apache 2.0 license found | ||
# in the LICENSE file in the root directory of this source tree. | ||
|
||
set -e | ||
curl -sSf https://atlasgo.sh | sh | ||
if [ -n "$ATLAS_TOKEN" ]; then | ||
atlas login --token $ATLAS_TOKEN | ||
fi |