forked from kahing/goofys
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from StatCan/add-dockerfile-and-workflow
Add dockerfile and workflow
- Loading branch information
Showing
46 changed files
with
2,698 additions
and
57 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 |
---|---|---|
@@ -0,0 +1,69 @@ | ||
name: build-and-push | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
types: | ||
- 'opened' | ||
- 'synchronize' | ||
- 'reopened' | ||
|
||
env: | ||
REGISTRY_NAME: k8scc01covidacr | ||
TRIVY_VERSION: "v0.43.1" | ||
HADOLINT_VERSION: "2.12.0" | ||
jobs: | ||
build-push: | ||
runs-on: ubuntu-latest | ||
services: | ||
registry: | ||
image: registry:2 | ||
ports: | ||
- 5000:5000 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
# Push image to ACR | ||
# Pushes if this is a push to master or an update to a PR that has auto-deploy label | ||
- name: Test if we should push to ACR | ||
id: should-i-push | ||
if: | | ||
github.event_name == 'push' || | ||
( | ||
github.event_name == 'pull_request' && | ||
contains( github.event.pull_request.labels.*.name, 'auto-deploy') | ||
) | ||
run: echo "::set-output name=boolean::true" | ||
|
||
# Connect to Azure Container registry (ACR) | ||
- uses: azure/docker-login@v1 | ||
with: | ||
login-server: ${{ env.REGISTRY_NAME }}.azurecr.io | ||
username: ${{ secrets.REGISTRY_USERNAME }} | ||
password: ${{ secrets.REGISTRY_PASSWORD }} | ||
|
||
- name: Run Hadolint | ||
run: | | ||
sudo curl -L https://github.com/hadolint/hadolint/releases/download/v${{ env.HADOLINT_VERSION }}/hadolint-Linux-x86_64 --output hadolint | ||
sudo chmod +x hadolint | ||
./hadolint ./Dockerfile --no-fail | ||
- name: Build image locally | ||
run: | | ||
docker build -f Dockerfile -t localhost:5000/mfcp-proxy-goofys-multi-inc:${{ github.sha }} . | ||
docker push localhost:5000/mfcp-proxy-goofys-multi-inc:${{ github.sha }} | ||
docker image prune | ||
- name: Aqua Security Trivy image scan | ||
run: | | ||
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin ${{ env.TRIVY_VERSION }} | ||
trivy image localhost:5000/mfcp-proxy-goofys-multi-inc:${{ github.sha }} --exit-code 1 --timeout=20m --security-checks vuln --severity CRITICAL | ||
# Container build and push to a Azure Container registry (ACR) | ||
- name: Push to ACR if necessary | ||
if: steps.should-i-push.outputs.boolean == 'true' | ||
run: | | ||
docker pull localhost:5000/mfcp-proxy-goofys-multi-inc:${{ github.sha }} | ||
docker tag localhost:5000/mfcp-proxy-goofys-multi-inc:${{ github.sha }} ${{ env.REGISTRY_NAME }}.azurecr.io/mfcp-proxy-goofys-multi-inc:${{ github.sha }} | ||
docker push ${{ env.REGISTRY_NAME }}.azurecr.io/mfcp-proxy-goofys-multi-inc:${{ github.sha }} |
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,40 @@ | ||
FROM golang:1.20.7 as fusermount3-proxy-builder | ||
|
||
WORKDIR /meta-fuse-csi-plugin | ||
ADD ./meta-fuse-csi-plugin . | ||
# Builds the meta-fuse-csi-plugin app | ||
RUN make fusermount3-proxy BINDIR=/bin | ||
|
||
FROM golang:1.20.7 as goofys-builder | ||
|
||
WORKDIR /goofys | ||
ADD . . | ||
# Builds the goofys app | ||
RUN make build | ||
|
||
FROM ubuntu:22.04 | ||
|
||
RUN apt update && apt upgrade -y | ||
RUN apt install -y ca-certificates wget libfuse2 fuse3 | ||
|
||
# prepare for MinIO | ||
RUN wget https://dl.min.io/client/mc/release/linux-amd64/mc -O /usr/bin/mc && chmod +x /usr/bin/mc | ||
|
||
COPY <<EOF /test.txt | ||
This is a test file for minio | ||
EOF | ||
|
||
COPY <<EOF /configure_minio.sh | ||
#!/bin/bash | ||
set -eux | ||
/usr/bin/mc alias set k8s-minio-dev http://localhost:9000 minioadmin minioadmin | ||
/usr/bin/mc mb k8s-minio-dev/test-bucket | ||
/usr/bin/mc cp /test.txt k8s-minio-dev/test-bucket | ||
EOF | ||
RUN chmod +x /configure_minio.sh | ||
|
||
#Get goofys build from first step | ||
COPY --from=goofys-builder /goofys/goofys . | ||
|
||
COPY --from=fusermount3-proxy-builder /bin/fusermount3-proxy /bin/fusermount3 | ||
RUN ln -sf /bin/fusermount3 /bin/fusermount |
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
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
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
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module github.com/kahing/goofys | ||
module github.com/StatCan/goofys | ||
|
||
go 1.14 | ||
|
||
|
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,6 @@ | ||
go 1.20 | ||
|
||
use ( | ||
. | ||
./meta-fuse-csi-plugin | ||
) |
Oops, something went wrong.