-
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.
- Loading branch information
Showing
5 changed files
with
144 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 |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: unicode-docker-repository | ||
run-name: unicode-docker-run | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Docker buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Build and push default image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
tags: pcadler/unicode-terraform-plugin:latest | ||
target: default | ||
|
||
- name: Build and push american image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
tags: ghcr.io/${{ github.repository }}/american-latest | ||
target: american | ||
|
||
- name: Build and push amphibian image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
tags: pcadler/unicode-terraform-plugin:amphibian-latest | ||
target: amphibian | ||
|
||
- name: Build and push halloween image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
tags: pcadler/unicode-terraform-plugin:halloween-latest | ||
target: halloween | ||
|
||
#test_docker_build: | ||
|
||
#test_apply_and_destroy: | ||
|
||
#push_docker_images: |
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,11 @@ | ||
provider_installation { | ||
|
||
dev_overrides { | ||
"hashicorp.com/edu/unicode" = "/home/app" | ||
} | ||
|
||
# For all other providers, install them directly from their origin provider | ||
# registries as normal. If you omit this, Terraform will _only_ use | ||
# the dev_overrides block, and so no other providers will be available. | ||
direct {} | ||
} |
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,65 @@ | ||
# Build Out Provider | ||
FROM golang:1.21-alpine AS compiler | ||
WORKDIR /terraform-provider-unicode | ||
COPY . . | ||
#RUN rm $GOPATH/go.mod | ||
RUN go build . | ||
RUN chmod +x terraform-provider-unicode | ||
RUN chown 1000:1000 terraform-provider-unicode | ||
RUN chgrp 1000 terraform-provider-unicode | ||
|
||
# Temporary Container TO Build User | ||
FROM debian:stretch-slim as auth | ||
RUN groupadd -g 1000 app && useradd -u 1000 -g 1000 -m app | ||
|
||
# Copy Into Terraform Container | ||
FROM hashicorp/terraform:light as default | ||
# Make User 1000 | ||
COPY --from=auth /etc/passwd /etc/passwd | ||
COPY --from=auth /etc/group /etc/group | ||
COPY --from=auth /home/app /home/app | ||
RUN chown 1000:1000 /home/app | ||
# Make Home Directory | ||
COPY --from=compiler /terraform-provider-unicode/terraform-provider-unicode /home/app/terraform-provider-unicode | ||
COPY --from=compiler /terraform-provider-unicode/.terraformrc /home/app/.terraformrc | ||
RUN chown 1000:1000 /home/app/.terraformrc | ||
RUN chown 1000:1000 /home/app/terraform-provider-unicode | ||
RUN chmod +x /home/app/terraform-provider-unicode | ||
# Now Switch to User app | ||
USER app | ||
WORKDIR /home/app | ||
ENTRYPOINT ["terraform", "apply", "-auto-approve"] | ||
CMD ["--var", "user=default"] | ||
# does this user follow you arround? | ||
|
||
# American App -> Take in variables and output | ||
FROM default as american | ||
USER app | ||
WORKDIR /home/app | ||
RUN mkdir america-themed-app | ||
COPY --from=compiler /terraform-provider-unicode/examples/america-themed_app/ /home/app/america-themed-app | ||
WORKDIR /home/app/america-themed-app | ||
#&& terraform init | ||
ENTRYPOINT [ "terraform", "apply","-auto-approve"] | ||
CMD ["--var", "user=default" ] | ||
|
||
FROM default as amphibian | ||
USER app | ||
WORKDIR /home/app | ||
RUN mkdir amphibian-themed-app | ||
COPY --from=compiler /terraform-provider-unicode/examples/amphibian_themed_app/ /home/app/amphibian-themed-app | ||
WORKDIR /home/app/amphibian-themed-app | ||
#&& terraform init | ||
ENTRYPOINT [ "terraform","apply","-auto-approve"] | ||
CMD ["--var", "user=default" ] | ||
|
||
|
||
FROM default as halloween | ||
USER app | ||
WORKDIR /home/app | ||
RUN mkdir halloween-themed-app | ||
COPY --from=compiler /terraform-provider-unicode/examples/halloween_themed_app/ /home/app/halloween-themed-app | ||
WORKDIR /home/app/halloween-themed-app | ||
|
||
ENTRYPOINT [ "terraform", "apply","-auto-approve"] | ||
CMD ["--var", "user=default" ] |
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