{"id":20136092,"url":"https://github.com/zkfmapf123/packer","last_synced_at":"2026-03-07T00:31:28.513Z","repository":{"id":178950932,"uuid":"623292532","full_name":"zkfmapf123/packer","owner":"zkfmapf123","description":"packer","archived":false,"fork":false,"pushed_at":"2023-07-05T14:32:41.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-02T22:42:07.110Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zkfmapf123.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-04T04:43:47.000Z","updated_at":"2023-07-05T14:09:23.000Z","dependencies_parsed_at":"2023-07-25T01:16:37.854Z","dependency_job_id":null,"html_url":"https://github.com/zkfmapf123/packer","commit_stats":null,"previous_names":["zkfmapf123/packer"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zkfmapf123/packer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zkfmapf123%2Fpacker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zkfmapf123%2Fpacker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zkfmapf123%2Fpacker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zkfmapf123%2Fpacker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zkfmapf123","download_url":"https://codeload.github.com/zkfmapf123/packer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zkfmapf123%2Fpacker/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30204154,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-06T19:07:06.838Z","status":"ssl_error","status_checked_at":"2026-03-06T18:57:34.882Z","response_time":250,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T21:17:41.325Z","updated_at":"2026-03-07T00:31:28.479Z","avatar_url":"https://github.com/zkfmapf123.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pakcer (이미지 빌드도구)\n\n## Todo\n\n- [x] nginx-ami\n- [ ] grafana-ami\n- [ ] docker-ami\n- [ ] openvpn-ami\n- [ ] side project use packer + terraform\n\n## Execute\n\n```\n    cd /infra\n    terraform init \u0026\u0026 terraform apply\n\n    cd packer\n    packer init . \u0026\u0026 packer build .\n```\n\n## Packer 동작과정\n\n```\n    packer init .\n    packer build .\n\n    =\u003e Create Temporary keypair\n    =\u003e Create Temporary sg (inbound 22)\n    =\u003e Create Temporary EC2 machine (기재된 내용의 ami)\n    =\u003e connect to 22 port\n    =\u003e packer source에 빌드된 내용을 설치\n    =\u003e Delete Temporary sg (inboud 22)\n    =\u003e Delete Temporary keypair\n    =\u003e Delete EC2\n    =\u003e Snapshot AMI\n\n```\n\n## Pakcer 삭제 과정\n\n- AMI 등록취소\n- EBS 스냅샷 삭제 (Create by ...)\n\n## Packer 특징\n\n\u003e 모든 Build는 Build 블록에서 이뤄짐\n\n- terraform 과 같이 선언형 언어이므로 순서는 중요하지 않음\n\n```hcl\n    // source.pkr.hcl\n    source \"null\" \"one\" {\n         communicator = \"none\"\n    }\n\n    source \"null\" \"two\" {\n        communicator = \"none\"\n    }\n\n    // main.pkr.hcl\n    build {\n        sources = [\n            \"source.null.one\",\n            \"source.null.two\"\n        ]\n    }\n\n    build {\n        name = \"leedonggyu\" // naming\n\n        sources = [\n            \"source.null.one\",\n            \"source.null.two\"\n        ]\n    }\n\n    // only\n    pakcer build --only=\"null.one\" .\n```\n\n\u003e source 블록자체의 필요한 항목들을 build 블록에서 정의 가능함\n\n- 두개의 ami를 띄우는데 각각 항목당 provisioning 코드가 4개씩임..\n\n```\n    build {\n    source \"amazon-ebs.ubuntu\" {\n        name = \"example\"\n        ami_name = \"leedonggyu-v1\"\n    }\n\n    source \"amazon-ebs.ubuntu\" {\n        name = \"example-2\"\n        ami_name = \"leedonggyu-v2\"\n    }\n\n    provisioner \"shell\" {\n        inline = [\n            \"echo hello world!! = 1\"\n        ]\n    }\n\n    provisioner \"shell\" {\n        inline = [\n            \"echo hello world!! = 2\"\n        ]\n    }\n\n    provisioner \"shell\" {\n        inline = [\n            \"echo hello world!! = 3\"\n        ]\n    }\n\n    provisioner \"shell\" {\n        inline = [\n            \"echo hello world!! = 4\"\n        ]\n    }\n}\n```\n\n\u003e post-processor\n\n- 후처리기\n- provisioner 이후에 발생될 작업들을 정의한다.\n- 빌드된 내용들의 정리나... zip파일 compress작업...\n- \u003ca href=\"https://developer.hashicorp.com/packer/docs/post-processors/compress\"\u003epost-processor document\u003ca\u003e\n\n## Reference\n\n- \u003ca href=\"https://developer.hashicorp.com/packer/docs/templates/json_to_hcl\"\u003eDocument\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzkfmapf123%2Fpacker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzkfmapf123%2Fpacker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzkfmapf123%2Fpacker/lists"}