Docker File
Docker File 官方說明
Dockerfile reference | Docker Documentation
Build Dockerfile
# docker image build -t {name}:{tag} {dokerfile 目錄}
docker image build -t hello_py:v1 .
Docker File 結構
# 基礎鏡像檔
FROM ubuntu:21.04
# 環境變數
ENV VERSION=2.0.1
# 執行命令(可在執行容器的時候使用其他命覆蓋)
RUN apt-get update && \
apt-get install -y wget && \
wget https://github.com/ipinfo/cli/releases/download/ipinfo-${VERSION}/ipinfo_${VERSION}_linux_amd64.tar.gz && \
tar zxf ipinfo_${VERSION}_linux_amd64.tar.gz && \
mv ipinfo_${VERSION}_linux_amd64 /usr/bin/ipinfo && \
rm -rf ipinfo_${VERSION}_linux_amd64.tar.gz
# 複製檔案
COPY hello.py /app/hello.py
# 執行命令(無法覆蓋)
ENTRYPOINT ["echo", "hello docker"]