Dockerfile FROM指令使用相同的标记

时间:2016-09-08 11:25:18

标签: dockerfile

我有以下泊坞窗层次结构

A / Dockerfile:

import xlrd                                                                                              
import MySQLdb                                                                                           

#Seting the database connection                                                                          
database = MySQLdb.connect (host="localhost", user = "root", passwd = "****", db = "python_insert")      
cursor = database.cursor()                                                                               
query = """INSERT IGNORE INTO test (masina,data_ora,conbustibil) VALUES (%s,%s,%s)"""               


#Open and parse the xcell file                                                                           
book = xlrd.open_workbook("asset/testing.xlsx")                                                          
sheet = book.sheet_by_name("Report")                                                                     
for r in range(1, sheet.nrows):                                                                          
    masina = sheet.cell(r, 1).value                                                                      
    data_ora = sheet.cell(r, 0).value                                                                    
    conbustibil = sheet.cell(r, 8).value                                                                 
    values = (masina, data_ora, conbustibil)                                                             
    cursor.execute(query, values)                                                                        


#Closing cursor+database                                                                                 
cursor.close()                                                                                           
database.commit()                                                                                        
database.close()                                                                                         


print "Succes"                                                                                           
columns = str(sheet.ncols)                                                                               
rows = str(sheet.nrows)                                                                                  
print ("Am importat " + columns + " coloane si " + rows + " randuri in MySQL")                           

B / Dockerfile:

FROM alpine:3.4

这是构建命令:

FROM a:1
RUN somethingB

我希望a和b的标记始终与每个版本同步(实际上是docker build -t a:1 a docker build -t b:1 b )。是否可以在每次构建之前没有" sed" b / Dockerfile并在调用git rev-parse HEAD之前将FROM a:1更改为FROM a:2

我遇到这些麻烦的原因是:

  • 同一个git repo的多个版本与同一个docker主机并行运行,但每个版本都有不同的HEAD(标记)

  • b:1有一个姐妹码头(c:1),它也取决于:1(所以我不能简单地将a和b合并到同一个dockerfile

0 个答案:

没有答案