tker-78 / my_portfolio_v1

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GCPにデプロイ

GCP(Cloud Run)にデプロイする。

ここを参考にする。

Dockerfileを作成する。

# Use a nginx Docker image
FROM nginx

# Copy the static HTMLs to the nginx directory
COPY public /usr/share/nginx/html

# Copy the nginx configuration template to the nginx config directory
COPY nginx/default.template /etc/nginx/conf.d/default.template

# Substitute the environment variables and generate the final config
CMD envsubst < /etc/nginx/conf.d/default.template > /etc/nginx/conf.d/default.conf && exec nginx -g 'daemon off;'

nginx/default.templateを作成する。

server {
    listen       ${PORT};
    server_name  localhost;
    location / {
        root   /usr/share/nginx/html;
        index  index.html index.htm;
    }
}

Dockerを起動する。

$ docker build -t my_portfolio_v1 .
$ docker run -p 1312:1312 -e PORT=1312 my_portfolio_v1

コンテナイメージをsubmitする。

$ gcloud builds submit --tag gcr.io/my-portfolio-v1-409721/my-portfolio-v1-container-image

CI/CDの構築がよくわからないので、GitHub Pagesを使った方が良さそう。

GitHub Pagesにデプロイ

HUGOのドキュメントを参考にする。

About


Languages

Language:HTML 99.7%Language:Dockerfile 0.3%