Skip to content

Instantly share code, notes, and snippets.

@lgvital
Created August 12, 2019 07:45
Show Gist options
  • Save lgvital/92e3138058a0bdef0c2a3b10c7b05909 to your computer and use it in GitHub Desktop.
Save lgvital/92e3138058a0bdef0c2a3b10c7b05909 to your computer and use it in GitHub Desktop.
lionel@machine:~/code/cookiecutter_aws (master)$ python convert-docker-compose-to-aws.py
DOCKERHUB_USER=lionelv
Input file: production.yml
Output file: production.yml
redis uses an image, skipping
Building postgres
Step 1/4 : FROM postgres:11.3
---> 4e045cb8eecd
Step 2/4 : COPY ./compose/production/postgres/maintenance /usr/local/bin/maintenance
---> Using cache
---> 93150de3a9cc
Step 3/4 : RUN chmod +x /usr/local/bin/maintenance/*
---> Using cache
---> 7c75bd3de45e
Step 4/4 : RUN mv /usr/local/bin/maintenance/* /usr/local/bin && rmdir /usr/local/bin/maintenance
---> Using cache
---> 6e7bde13e3ef
Successfully built 6e7bde13e3ef
Successfully tagged cookiecutter_aws_production_postgres:latest
Building django
Step 1/19 : FROM python:3.6-alpine
---> 2068eb9e7f62
Step 2/19 : ENV PYTHONUNBUFFERED 1
---> Using cache
---> 7a95a3bced06
Step 3/19 : RUN apk update && apk add --virtual build-deps gcc python3-dev musl-dev && apk add postgresql-dev && apk add jpeg-dev zlib-dev freetype-dev lcms2-dev openjpeg-dev tiff-dev tk-dev tcl-dev && apk add libffi-dev py-cffi
---> Using cache
---> 92b76d2e9f42
Step 4/19 : RUN addgroup -S django && adduser -S -G django django
---> Using cache
---> 1027c5bf9232
Step 5/19 : COPY ./requirements /requirements
---> Using cache
---> 4ce92764925b
Step 6/19 : RUN pip install --no-cache-dir -r /requirements/production.txt && rm -rf /requirements
---> Using cache
---> 2d47afa1cd02
Step 7/19 : COPY ./compose/production/django/entrypoint /entrypoint
---> Using cache
---> db1425502e32
Step 8/19 : RUN sed -i 's/\r$//g' /entrypoint
---> Using cache
---> 2f182b4757f5
Step 9/19 : RUN chmod +x /entrypoint
---> Using cache
---> 770360ecbcd1
Step 10/19 : RUN chown django /entrypoint
---> Using cache
---> 10c025e0d3b0
Step 11/19 : COPY ./compose/production/django/start /start
---> Using cache
---> 9e5b8e35967a
Step 12/19 : RUN sed -i 's/\r$//g' /start
---> Using cache
---> 7f7745e9c631
Step 13/19 : RUN chmod +x /start
---> Using cache
---> 380e1de0c6e2
Step 14/19 : RUN chown django /start
---> Using cache
---> 089e7654062a
Step 15/19 : COPY . /app
---> 23e25da2fdd7
Step 16/19 : RUN chown -R django /app
---> Running in 19ca9fd1000e
Removing intermediate container 19ca9fd1000e
---> cce9b229b61f
Step 17/19 : USER django
---> Running in ebf98c5e5d79
Removing intermediate container ebf98c5e5d79
---> 46cc3ab23495
Step 18/19 : WORKDIR /app
---> Running in c879afb337e5
Removing intermediate container c879afb337e5
---> 4ea6dce3306c
Step 19/19 : ENTRYPOINT ["/entrypoint"]
---> Running in 333b9ba7450f
Removing intermediate container 333b9ba7450f
---> 7ea94c27e960
Successfully built 7ea94c27e960
Successfully tagged cookiecutter_aws_production_django:latest
Building traefik
Step 1/5 : FROM traefik:alpine
---> 11f1b77e546a
Step 2/5 : RUN mkdir -p /etc/traefik/acme
---> Using cache
---> 389a72e6997b
Step 3/5 : RUN touch /etc/traefik/acme/acme.json
---> Using cache
---> 42d85733deb5
Step 4/5 : RUN chmod 600 /etc/traefik/acme/acme.json
---> Using cache
---> 2d37ab017051
Step 5/5 : COPY ./compose/production/traefik/traefik.toml /etc/traefik
---> Using cache
---> 2e9938b62a15
Successfully built 2e9938b62a15
Successfully tagged cookiecutter_aws_production_traefik:latest
Building awscli
Step 1/5 : FROM garland/aws-cli-docker:1.15.47
---> 8f85f62e7b19
Step 2/5 : COPY ./compose/production/aws/maintenance /usr/local/bin/maintenance
---> Using cache
---> 19ddae3916b6
Step 3/5 : COPY ./compose/production/postgres/maintenance/_sourced /usr/local/bin/maintenance/_sourced
---> Using cache
---> 2e54a9afb39c
Step 4/5 : RUN chmod +x /usr/local/bin/maintenance/*
---> Using cache
---> e6b41ddb2f66
Step 5/5 : RUN mv /usr/local/bin/maintenance/* /usr/local/bin && rmdir /usr/local/bin/maintenance
---> Using cache
---> 47b9fc5734a2
Successfully built 47b9fc5734a2
Successfully tagged cookiecutter_aws_awscli:latest
The push refers to repository [docker.io/lionelv/cookiecutter_aws_django]
Error response from daemon: No such image: cookiecutter_aws_production_awscli:latest
Traceback (most recent call last):
File "convert-docker-compose-to-aws.py", line 57, in <module>
subprocess.check_call(["docker", "tag", compose_image, hub_image])
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 291, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['docker', 'tag', 'cookiecutter_aws_production_awscli', 'lionelv/cookiecutter_aws_awscli:1565595109']' returned non-zero exit status 1.
The push refers to repository [docker.io/lionelv/cookiecutter_aws_postgres]
The push refers to repository [docker.io/lionelv/cookiecutter_aws_traefik]
bc10f37287ec: Preparing
f67354915955: Preparing
7d20848881a6: Preparing
cb85b432fe04: Preparing
4f362e67d308: Preparing
ffb120c1ca6d: Preparing
934692f60113: Preparing
b32c5c028077: Preparing
329728a74c18: Preparing
0984d5204ecc: Preparing
6508305ea5ac: Preparing
1e3503928e03: Preparing
0d8998cd88fe: Preparing
5dad15d19022: Preparing
f7db612998d3: Preparing
0ac0ccad5506: Preparing
2e1230d6dd66: Preparing
70ddf86e0061: Preparing
6e8e8d966ec9: Preparing
35a6f3e5f25e:
329728a74c18: Waiting
0984d5204ecc: Waiting
6508305ea5ac: Waiting
1e3503928e03: Waiting
0d8998cd88fe: Waiting
5dad15d19022: Waiting
f7db612998d3: Waiting
0ac0ccad5506: Waiting
b32c5c028077: Waiting
70ddf86e0061: Waiting
6e8e8d966ec9: Waiting
5701957a439e: Waiting
cf3741cc82d2: Waiting
b2017cfdc637: Waiting
46eac194dee6: Waiting
cf5b3c6798f7: Waiting
538b222605fd: Waiting
f39a848a9f0d: Waiting
8ecd2446d77e: Waiting
99186926d569: Waiting
7bea31916728: Waiting
1392bc088803: Waiting
04870cd09f47: Waiting
f1b5933fe4b5: Waiting
denied: requested access to the resource is denied
denied: requested access to the resource is denied
denied: requested access to the resource is denied
lionel@machine:~/code/cookiecutter_aws (master)$ python convert-docker-compose-to-aws.py
DOCKERHUB_USER=lionelv
Input file: production.yml
Output file: production.yml
redis uses an image, skipping
Building postgres
Step 1/4 : FROM postgres:11.3
---> 4e045cb8eecd
Step 2/4 : COPY ./compose/production/postgres/maintenance /usr/local/bin/maintenance
---> Using cache
---> 93150de3a9cc
Step 3/4 : RUN chmod +x /usr/local/bin/maintenance/*
---> Using cache
---> 7c75bd3de45e
Step 4/4 : RUN mv /usr/local/bin/maintenance/* /usr/local/bin && rmdir /usr/local/bin/maintenance
---> Using cache
---> 6e7bde13e3ef
Successfully built 6e7bde13e3ef
Successfully tagged cookiecutter_aws_production_postgres:latest
Building django
Step 1/19 : FROM python:3.6-alpine
---> 2068eb9e7f62
Step 2/19 : ENV PYTHONUNBUFFERED 1
---> Using cache
---> 7a95a3bced06
Step 3/19 : RUN apk update && apk add --virtual build-deps gcc python3-dev musl-dev && apk add postgresql-dev && apk add jpeg-dev zlib-dev freetype-dev lcms2-dev openjpeg-dev tiff-dev tk-dev tcl-dev && apk add libffi-dev py-cffi
---> Using cache
---> 92b76d2e9f42
Step 4/19 : RUN addgroup -S django && adduser -S -G django django
---> Using cache
---> 1027c5bf9232
Step 5/19 : COPY ./requirements /requirements
---> Using cache
---> 4ce92764925b
Step 6/19 : RUN pip install --no-cache-dir -r /requirements/production.txt && rm -rf /requirements
---> Using cache
---> 2d47afa1cd02
Step 7/19 : COPY ./compose/production/django/entrypoint /entrypoint
---> Using cache
---> db1425502e32
Step 8/19 : RUN sed -i 's/\r$//g' /entrypoint
---> Using cache
---> 2f182b4757f5
Step 9/19 : RUN chmod +x /entrypoint
---> Using cache
---> 770360ecbcd1
Step 10/19 : RUN chown django /entrypoint
---> Using cache
---> 10c025e0d3b0
Step 11/19 : COPY ./compose/production/django/start /start
---> Using cache
---> 9e5b8e35967a
Step 12/19 : RUN sed -i 's/\r$//g' /start
---> Using cache
---> 7f7745e9c631
Step 13/19 : RUN chmod +x /start
---> Using cache
---> 380e1de0c6e2
Step 14/19 : RUN chown django /start
---> Using cache
---> 089e7654062a
Step 15/19 : COPY . /app
---> 778e7ec85895
Step 16/19 : RUN chown -R django /app
---> Running in 54812ee4b5c2
Removing intermediate container 54812ee4b5c2
---> d425c3ce17c4
Step 17/19 : USER django
---> Running in 8d0bd2959e19
Removing intermediate container 8d0bd2959e19
---> ed35df8a66e6
Step 18/19 : WORKDIR /app
---> Running in 58e3f3cd490c
Removing intermediate container 58e3f3cd490c
---> 3d2872677a7a
Step 19/19 : ENTRYPOINT ["/entrypoint"]
---> Running in a77d44af92f3
Removing intermediate container a77d44af92f3
---> f9570b4a2e2b
Successfully built f9570b4a2e2b
Successfully tagged cookiecutter_aws_production_django:latest
Building traefik
Step 1/5 : FROM traefik:alpine
---> 11f1b77e546a
Step 2/5 : RUN mkdir -p /etc/traefik/acme
---> Using cache
---> 389a72e6997b
Step 3/5 : RUN touch /etc/traefik/acme/acme.json
---> Using cache
---> 42d85733deb5
Step 4/5 : RUN chmod 600 /etc/traefik/acme/acme.json
---> Using cache
---> 2d37ab017051
Step 5/5 : COPY ./compose/production/traefik/traefik.toml /etc/traefik
---> Using cache
---> 2e9938b62a15
Successfully built 2e9938b62a15
Successfully tagged cookiecutter_aws_production_traefik:latest
Building awscli
Step 1/5 : FROM garland/aws-cli-docker:1.15.47
---> 8f85f62e7b19
Step 2/5 : COPY ./compose/production/aws/maintenance /usr/local/bin/maintenance
---> Using cache
---> 19ddae3916b6
Step 3/5 : COPY ./compose/production/postgres/maintenance/_sourced /usr/local/bin/maintenance/_sourced
---> Using cache
---> 2e54a9afb39c
Step 4/5 : RUN chmod +x /usr/local/bin/maintenance/*
---> Using cache
---> e6b41ddb2f66
Step 5/5 : RUN mv /usr/local/bin/maintenance/* /usr/local/bin && rmdir /usr/local/bin/maintenance
---> Using cache
---> 47b9fc5734a2
Successfully built 47b9fc5734a2
Successfully tagged cookiecutter_aws_production_awscli:latest
The push refers to repository [docker.io/lionelv/cookiecutter_aws_django]
The push refers to repository [docker.io/lionelv/cookiecutter_aws_postgres]
Waiting for django push to complete...
The push refers to repository [docker.io/lionelv/cookiecutter_aws_traefik]
The push refers to repository [docker.io/lionelv/cookiecutter_aws_awscli]
46501db26c63: Preparing
0675be2b2a0b: Preparing
7d20848881a6: Preparing
cb85b432fe04: Preparing
4f362e67d308: Preparing
ffb120c1ca6d: Waiting
934692f60113: Waiting
35a6f3e5f25e: Waiting
0942c6c8c9f3: Waiting
8410c6f59ba1: Waiting
1268865b0516: Waiting
612ca42e3570: Waiting
a4b325d5efc5: Waiting
e1e5d2fe7527: Waiting
10a7e443255a: Waiting
3ba4c553a27d: Waiting
18d926a913e1: Waiting
b1f21386f4ff: Waiting
717b092b8c86: Waiting
b32c5c028077: Waiting
329728a74c18: Waiting
0984d5204ecc: Waiting
6508305ea5ac: Waiting
1e3503928e03: Waiting
0d8998cd88fe: Waiting
5dad15d19022: Waiting
f7db612998d3: Waiting
0ac0ccad5506: Waiting
2e1230d6dd66: Waiting
70ddf86e0061: Waiting
6e8e8d966ec9: Waiting
5701957a439e: Waiting
cf3741cc82d2: Waiting
b2017cfdc637: Waiting
46eac194dee6: Waiting
cf5b3c6798f7: Waiting
538b222605fd: Waiting
f39a848a9f0d: Waiting
8ecd2446d77e: Waiting
99186926d569: Waiting
7bea31916728: Waiting
1392bc088803: Waiting
04870cd09f47: Waiting
f1b5933fe4b5: Waiting
2dee4d9cb162: Waiting
5cea933eeab5: Waiting
9b171e61796d: Waiting
251157057cd1: Waiting
b60d724d8ea9: Waiting
a74f648826f1: Waiting
9dfa40a0da3b: Waiting
denied: requested access to the resource is denied
Done.
Waiting for postgres push to complete...
denied: requested access to the resource is denied
Done.
Waiting for traefik push to complete...
denied: requested access to the resource is denied
Done.
Waiting for awscli push to complete...
denied: requested access to the resource is denied
Done.
Wrote new compose file.
COMPOSE_FILE=production.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment