Skip to content

Commit 4376003

Browse files
Add terraform
1 parent 0aadb88 commit 4376003

3 files changed

Lines changed: 23 additions & 35 deletions

File tree

.github/workflows/publish.yml

Lines changed: 5 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,33 @@
1-
# TODO:
1+
# NOTES:
22
# 1. Create PAT with `read:packages` and `write:packages` see https://docs.github.com/en/free-pro-team@latest/packages/guides/migrating-to-github-container-registry-for-docker-images#authenticating-with-the-container-registry
33
# 2. Create CR_PAT variable under Settings / Secrets
44

55
name: BUILD Docker
66

77
on:
8-
push:
9-
10-
# Publish `v1.2.3` tags as releases.
11-
tags:
12-
- v*
13-
8+
release:
9+
types:
10+
- created
1411

1512
env:
1613
FETCHER_IMAGE_VERSION: 3.15.0
1714
BASE_IMAGE_VERSION: commit-f2d623ca9d270c2ce8560d2ca0f9ce71b105aff2 # See https://hub.docker.com/r/gitpod/workspace-base/tags
18-
19-
# NOTE: DO NOT CHANGE THIS IS TMP IMAGE NAME
20-
IMAGE_NAME: image
2115

2216
jobs:
23-
# Run tests.
24-
# See also https://docs.docker.com/docker-hub/builds/automated-testing/
2517
test:
2618
runs-on: ubuntu-latest
2719

2820
steps:
2921
- uses: actions/checkout@v2
3022

31-
- name: Run tests
32-
run: |
33-
docker build . \
34-
--build-arg FETCHER_IMAGE_VERSION=${FETCHER_IMAGE_VERSION} \
35-
--build-arg BASE_IMAGE_VERSION=${BASE_IMAGE_VERSION} \
36-
--file Dockerfile --tag $IMAGE_NAME
37-
# Push image to GitHub Packages.
38-
# See also https://docs.docker.com/docker-hub/builds/
39-
push:
40-
# Ensure test job passes before pushing image.
41-
needs: test
42-
43-
runs-on: ubuntu-latest
44-
if: github.event_name == 'push'
45-
46-
steps:
47-
- uses: actions/checkout@v2
48-
49-
- name: Build image
23+
- name: Run build
5024
run: |
5125
docker build . \
5226
--build-arg FETCHER_IMAGE_VERSION=${FETCHER_IMAGE_VERSION} \
5327
--build-arg BASE_IMAGE_VERSION=${BASE_IMAGE_VERSION} \
5428
--file Dockerfile --tag $IMAGE_NAME
5529
5630
- name: Log into GitHub Container Registry
57-
# TODO: Create a PAT with `read:packages` and `write:packages` scopes and save it as an Actions secret `CR_PAT`
5831
run: echo "${{ secrets.CR_PAT }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
5932

6033
- name: Push image to GitHub Container Registry

.github/workflows/test.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,10 @@ jobs:
3131
--build-arg FETCHER_IMAGE_VERSION=${FETCHER_IMAGE_VERSION} \
3232
--build-arg BASE_IMAGE_VERSION=${BASE_IMAGE_VERSION} \
3333
--file Dockerfile --tag $IMAGE_NAME
34+
test-image-ls:
35+
runs-on: ubuntu-latest
36+
37+
steps:
38+
- name: Run tests
39+
run: |
40+
docker image ls

Dockerfile

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ ENV KUSTOMIZE_VERSION=v4.4.1
1313
ENV KUSTIMIZE_HELM_PLUGIN=v0.9.2
1414
ENV STARSHIP_VERSION=v1.1.1
1515
ENV DOCKER_VERSION=20.10.9
16+
ENV TERRAFORM_VERSION=1.1.2
1617

1718
RUN mkdir /tmp/completion
1819

@@ -26,19 +27,25 @@ RUN mkdir -p /root/.config/kustomize/plugin/helm.kustomize.mgoltzsche.github.com
2627
wget -O- https://github.com/mgoltzsche/helm-kustomize-plugin/releases/download/${KUSTIMIZE_HELM_PLUGIN}/helm-kustomize-plugin > /root/.config/kustomize/plugin/helm.kustomize.mgoltzsche.github.com/v1/chartrenderer/ChartRenderer && \
2728
chmod u+x /root/.config/kustomize/plugin/helm.kustomize.mgoltzsche.github.com/v1/chartrenderer/ChartRenderer
2829

29-
# Gosu https://github.com/tianon/gosu/blob/master/hub/Dockerfile.alpine
30-
# TODO
31-
3230
ADD https://raw.githubusercontent.com/perlpunk/shell-completions/6af9f7cd5db837680aef453ca6ded1a3dd219eae/zsh/_jq /tmp/completion/_jq
3331

3432
# Starship https://github.com/starship/starship
3533
RUN wget -O- https://github.com/starship/starship/releases/download/${STARSHIP_VERSION}/starship-x86_64-unknown-linux-gnu.tar.gz | tar xvz -C /usr/local/bin/
3634
RUN chmod +x /usr/local/bin/starship
3735

36+
# Terrraform https://github.com/starship/starship
37+
RUN wget -O- https://github.com/starship/starship/releases/download/${STARSHIP_VERSION}/starship-x86_64-unknown-linux-gnu.tar.gz | tar xvz -C /usr/local/bin/
38+
RUN chmod +x /usr/local/bin/starship
39+
3840
# Docker https://github.com/moby/moby
3941
RUN wget -O- https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKER_VERSION}.tgz | tar xvz -C /usr/local/bin/
4042
RUN chmod +x /usr/local/bin/docker
4143

44+
# Terraform https://github.com/hashicorp/terraform
45+
RUN wget -O- https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip
46+
RUN unzip terraform_${TERRAFORM_VERSION}_linux_amd64.zip -d /tmp
47+
RUN chmod +x /tmp/terraform
48+
4249
# AWS CLI
4350
RUN wget https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip
4451
RUN unzip awscli-exe-linux-x86_64.zip -d /tmp
@@ -70,6 +77,7 @@ COPY --from=FETCHER /usr/local/bin/starship /usr/local/bin/starship
7077
COPY --from=FETCHER /usr/local/bin/docker/docker /usr/local/bin/docker
7178
COPY --from=FETCHER /usr/local/aws-cli/ /usr/local/aws-cli/
7279
COPY --from=FETCHER /tmp/aws-cli-bin/ /usr/local/bin/
80+
COPY --from=FETCHER /tmp/terraform /usr/local/bin/
7381

7482
RUN chsh -s /usr/bin/zsh ${RUN_AS_USER}
7583

0 commit comments

Comments
 (0)