-
Notifications
You must be signed in to change notification settings - Fork 4
Containerise dependencies required to run tasks in dev workflow #53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
6fe352f
48d112b
b26044d
2ef4633
dac6b1f
dfe10c3
30c6a4c
3e5c1cd
30b7781
e26440e
0e669a9
0da51be
a75abac
e77f4f0
68ecc8d
cdcc991
a05d485
c8566f2
b823872
4e7619e
6649ed7
cba7c04
5b4b5aa
3c23789
1226492
629cb1e
0825b3e
8889f47
83c1dc0
4de1ef6
a3ef59e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: WG-Easy Image CI | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
paths: | ||
- 'applications/wg-easy/**' | ||
- '.github/workflows/wg-easy-image.yml' | ||
pull_request: | ||
paths: | ||
- 'applications/wg-easy/**' | ||
- '.github/workflows/wg-easy-image.yml' | ||
workflow_dispatch: | ||
|
||
env: | ||
DEV_CONTAINER_REGISTRY: ghcr.io | ||
DEV_CONTAINER_IMAGE: replicatedhq/platform-examples/wg-easy-tools | ||
|
||
jobs: | ||
build-and-push: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Log in to GHCR | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.DEV_CONTAINER_REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.DEV_CONTAINER_REGISTRY }}/${{ env.DEV_CONTAINER_IMAGE }} | ||
tags: | | ||
type=raw,value=latest,enable={{is_default_branch}} | ||
type=sha,format=short | ||
type=ref,event=branch | ||
type=ref,event=pr | ||
|
||
- name: Build and push image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: applications/wg-easy | ||
file: applications/wg-easy/container/Containerfile | ||
platforms: linux/amd64,linux/arm64 | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# Base image for all shared Containerfiles for taskfiles | ||
# Use this image as base image for app specific container files | ||
FROM --platform=$BUILDPLATFORM ubuntu:24.04 | ||
|
||
ARG TARGETOS | ||
ARG TARGETARCH | ||
|
||
WORKDIR /tools | ||
|
||
# Set environment variables | ||
ENV DEBIAN_FRONTEND=noninteractive \ | ||
HOME=/home/devuser \ | ||
SHELL=/bin/bash | ||
|
||
# Install debian packages | ||
RUN apt-get update && apt-get install -y \ | ||
curl \ | ||
jq \ | ||
less \ | ||
yq \ | ||
gnupg \ | ||
bash-completion \ | ||
|
||
# Install Google Cloud CLI | ||
&& echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list \ | ||
&& curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg \ | ||
&& apt-get update \ | ||
&& apt-get install google-cloud-cli -y \ | ||
|
||
# Clean up | ||
&& apt-get purge -y gnupg \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
Check warning on line 32 in applications/wg-easy/container/Containerfile
|
||
|
||
# Install helm | ||
RUN curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash \ | ||
|
||
# Install kubectl | ||
&& curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/${TARGETARCH}/kubectl" \ | ||
&& chmod +x kubectl \ | ||
&& mv kubectl /usr/local/bin/ \ | ||
|
||
# Install Task | ||
&& sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin \ | ||
|
||
# Install Helmfile | ||
&& curl -Ls $(curl -s https://api.github.com/repos/helmfile/helmfile/releases/latest \ | ||
| grep "browser_download_url.*linux_${TARGETARCH}.tar.gz" \ | ||
| cut -d : -f 2,3 \ | ||
| tr -d \") -o helmfile.tar.gz \ | ||
&& tar xf helmfile.tar.gz helmfile && rm helmfile.tar.gz \ | ||
&& mv helmfile /usr/local/bin/helmfile \ | ||
|
||
# Install Replicated CLI | ||
&& curl -Ls $(curl -s https://api.github.com/repos/replicatedhq/replicated/releases/latest \ | ||
| grep "browser_download_url.*linux_amd64.tar.gz" \ | ||
| cut -d : -f 2,3 \ | ||
| tr -d \") -o replicated.tar.gz \ | ||
&& tar xf replicated.tar.gz replicated && rm replicated.tar.gz \ | ||
&& mv replicated /usr/local/bin/replicated | ||
Check warning on line 59 in applications/wg-easy/container/Containerfile
|
||
|
||
# Create a non-root user for better security | ||
RUN groupadd -r devuser && useradd -r -g devuser -m -s /bin/bash devuser | ||
|
||
# Copy shell completion scripts | ||
COPY container/tool-completions.sh tool-completions.sh | ||
|
||
# Copy entrypoint script | ||
COPY container/entrypoint.sh entrypoint.sh | ||
RUN chmod +x entrypoint.sh | ||
|
||
# Set working directory | ||
WORKDIR /workspace | ||
|
||
# Switch to non-root user | ||
USER devuser | ||
|
||
# Set entrypoint | ||
ENTRYPOINT ["/tools/entrypoint.sh", "-l"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
# Uncomment force_color_prompt in bashrc | ||
sed -i 's/#force_color_prompt=yes/force_color_prompt=yes/' $HOME/.bashrc | ||
|
||
# Source the tool completions | ||
echo "source /tools/tool-completions.sh" >> $HOME/.bashrc | ||
|
||
# Execute the passed command or default to bash | ||
exec "$@" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
|
||
# kubectl completion | ||
source <(kubectl completion bash) | ||
alias k=kubectl | ||
complete -o default -F __start_kubectl k | ||
|
||
# helm completion | ||
source <(helm completion bash) | ||
|
||
# task completion | ||
source <(task --completion bash) | ||
|
||
# helmfile completion | ||
source <(helmfile completion bash) | ||
|
||
# replicated completion | ||
source <(replicated completion bash) | ||
|
||
# gcloud completion | ||
source /usr/share/google-cloud-sdk/completion.bash.inc |
Uh oh!
There was an error while loading. Please reload this page.