0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Dockerfileで環境変数を仕込みつつRUNでファイルを生成する

Posted at

ファイル

FROM centos:centos7

ARG DOMAIN
RUN echo -e "\n\
AP_HOSTNAME=https://${DOMAIN}.vamdemic.xyz\n\
DB_HOSTNAME=${DOMAIN}-db\n\
DB_USERNAME=root\n\
DB_PASSWORD=password\n\
" >> /root/test

CMD ["/sbin/init"]

ビルド

docker build -t test . --build-arg DOMAIN=aiueo

ビルドされたファイル

 yuta  /  tmp  docker  docker exec -it be29d6b986db /bin/bash
[root@be29d6b986db /]#
[root@be29d6b986db /]# cat /root/test

AP_HOSTNAME=https://aiueo.vamdemic.xyz
DB_HOSTNAME=aiueo-db
DB_USERNAME=root
DB_PASSWORD=password

[root@be29d6b986db /]#

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?