Skip to content

Instantly share code, notes, and snippets.

@DALDEI
Created September 15, 2017 02:22
Show Gist options
  • Save DALDEI/e8e9e80b54fe58980ce9d544d65d5ee5 to your computer and use it in GitHub Desktop.
Save DALDEI/e8e9e80b54fe58980ce9d544d65d5ee5 to your computer and use it in GitHub Desktop.
packer-push bug input
{ "variables": {
"amznrepo" : "file:///var/repo",
"version" : "1.0",
"repository" : "nexstra/createrepo",
"baseImage" : "amazonlinux:latest",
"yumrepo" : "",
"amznrepo" : "/space/amazonlinux/repo",
"yumrepod" : "{{pwd}}/../yum.repos.d",
"awsEcr" : "{{env `AWS_ECR`}}",
"doEcrLogin" : "true"
},
"builders" : [
{
"type": "docker",
"image":"{{user `baseImage`}}",
"commit" : true ,
"volumes" : {
"{{user `amznrepo`}}/amzn-main" : "/var/repo/amzn-main",
"{{user `amznrepo`}}/amzn-updates" : "/var/repo/amzn-updates",
"{{user `yumrepo`}}" : "/var/repo/nexstra",
"{{user `yumrepod`}}" : "/etc/yum.repos.d"
},
"run_command" : [
"-d" , "-i" , "-t" ,
"--entrypoint", "/bin/bash" ,
"{{.Image}}" ],
"changes" : [
"WORKDIR /tmp",
"CMD [ \"createrepo\", \"/rpms\"]",
"LABEL project=createrepo version={{user `version`}} from={{user `baseImage`}}",
"VOLUME /rpms"
]
}],
"provisioners" : [
{
"type":"shell",
"inline" : [
"yum -y install createrepo yum-utils",
"mkdir /rpms",
"true"
],
"environment_vars": [
"_AMZN_REPO={{user `amznrepo`}}"
]
}
],
"post-processors": [
{
"type" : "docker-tag" ,
"repository" : "{{user `repository`}}",
"tag" : "{{user `version`}}"
},
{
"type" : "docker-tag" ,
"repository" : "{{user `awsEcr`}}/{{user `repository`}}",
"tag" : "{{user `version`}}"
},
{
"type": "docker-push" ,
"login_email" : "{{user `email`}}",
"aws_access_key" : "{{user `awsaccesskey`}}",
"aws_secret_key" : "{{user `awssecretkey`}}",
"ecr_login" : "{{user `doEcrLogin`}}",
"login_server" : "https://{{user `awsEcr`}}/"
},
{
"type" : "manifest",
"output": "linux-manifest.json"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment