Skip to content
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

Add Makefile and apko config for a local dev-container environment #1123

Merged
merged 5 commits into from
Nov 10, 2023

Conversation

jamonation
Copy link
Member

@jamonation jamonation commented Nov 8, 2023

This is a bit of an experiment that I hope we can turn into a daily tool for Academy work with various supporting tools. To start it adds a Makefile with two targets, apko-build and dev-container.

  1. apko-build: creates a local image for Academy development, using our cgr.dev/chainguard/apko image and the included apko.yaml file in this PR.
  2. dev-container: runs the image with various volumes mounted into it, and ports forwarded with a copy of Hugo and nginx to start with.

Future versions can add things like autodocs, rumble code, chainlink and so on.

To test, run:

make apko-build
make dev-container

Once it builds and runs, use hugo serve --bind 0.0.0.0 and then visit http://localhost:1313 when it is ready.

To build and preview HTML files with the included nginx, run hugo -e local-dev, then visit http://localhost:8080.

Docker and make are the only prerequisites to run this I think.

@jamonation jamonation requested a review from a team as a code owner November 8, 2023 22:56
Copy link

netlify bot commented Nov 8, 2023

Deploy Preview for ornate-narwhal-088216 ready!

Name Link
🔨 Latest commit 92394ef
🔍 Latest deploy log https://app.netlify.com/sites/ornate-narwhal-088216/deploys/654d130bf6e35800080cf81e
😎 Deploy Preview https://deploy-preview-1123--ornate-narwhal-088216.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Makefile Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
@jamonation jamonation added enhancement New feature or request Q4 2023 Project platform development Chaingaurd Academy dev work labels Nov 9, 2023
@jamonation jamonation self-assigned this Nov 9, 2023
@jamonation jamonation changed the title WIP: Add Makefile and apko config for a dev-container experience Add Makefile and apko config for a dev-container experience Nov 9, 2023
@jamonation jamonation changed the title Add Makefile and apko config for a dev-container experience Add Makefile and apko config for a local dev-container environment Nov 9, 2023
apko.yaml Show resolved Hide resolved
@erikaheidi
Copy link
Collaborator

I got an error when trying to run the make dev-container command. It seems there is some platform mismatch:

INFO[0007] Final index tgz at: /work/academy.tar        
docker load < academy.tar
aa6782e0dc57: Loading layer [==================================================>]  86.15MB/86.15MB
Loaded image: academy.local:latest-amd64
rm academy.tar
rm: remove write-protected regular file 'academy.tar'? y
❯ make dev-container
docker run --rm \
-v $PWD/config/entrypoint.sh:/entrypoint.sh \
-v $PWD/public:/usr/share/nginx/html \
-v $PWD/nginx.conf:/etc/nginx/nginx.conf \
-v $PWD:/home/inky/ \
-p 8080:8080 -p 1313:1313 \
-it --user root \
academy.local:latest-x86_64
Unable to find image 'academy.local:latest-x86_64' locally
docker: Error response from daemon: pull access denied for academy.local, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.
See 'docker run --help'.
make: *** [Makefile:13: dev-container] Error 125

@jamonation
Copy link
Member Author

Ahh thanks for checking @erikaheidi - seems like the uname -m output is doing something strange with both amd64 and x86_64. I'll try to figure out how to set that properly.

Copy link
Collaborator

@erikaheidi erikaheidi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it works now! great work Jamon 👏🏼

@jamonation jamonation merged commit 59e6da6 into main Nov 10, 2023
7 checks passed
@jamonation jamonation deleted the dev-container-experience branch November 10, 2023 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request platform development Chaingaurd Academy dev work Q4 2023 Project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants