added nginx config and rewrote Dockerfile and gitlab ci
This commit is contained in:
+10
-6
@@ -1,9 +1,10 @@
|
|||||||
image: "gitlab/dind"
|
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- build
|
- build
|
||||||
- dockerize
|
- dockerize
|
||||||
|
|
||||||
|
variables:
|
||||||
|
CONTAINER_IMAGE: registry.gitlab.com/ahmza/blog:latest
|
||||||
|
|
||||||
Build:
|
Build:
|
||||||
stage: build
|
stage: build
|
||||||
image: alpine:latest
|
image: alpine:latest
|
||||||
@@ -20,8 +21,11 @@ Build:
|
|||||||
|
|
||||||
Dockerize:
|
Dockerize:
|
||||||
stage: dockerize
|
stage: dockerize
|
||||||
before_script:
|
image:
|
||||||
- docker login registry.gitlab.com -u ahmza -p $CI_DOCKER_ACCESS_TOKEN
|
name: gcr.io/kaniko-project/executor:debug
|
||||||
|
entrypoint: [""]
|
||||||
script:
|
script:
|
||||||
- docker build -t registry.gitlab.com/ahmza/blog .
|
- mkdir -p /kaniko/.docker
|
||||||
- docker push registry.gitlab.com/ahmza/blog
|
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
|
||||||
|
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
|
||||||
|
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:latest
|
||||||
|
|||||||
+5
-6
@@ -1,6 +1,5 @@
|
|||||||
FROM alpine:latest
|
FROM nginx:alpine
|
||||||
RUN which curl || ( apk update && apk add curl )
|
COPY .build /var/www
|
||||||
RUN curl -L https://github.com/gohugoio/hugo/releases/download/v0.90.0/hugo_0.90.0_Linux-64bit.tar.gz > hugo.tar.gz
|
COPY nginx.conf /etc/nginx/nginx.conf
|
||||||
RUN tar -zxf hugo.tar.gz
|
EXPOSE 80
|
||||||
RUN mv hugo /usr/local/bin/hugo
|
ENTRYPOINT ["nginx","-g","daemon off;"]
|
||||||
CMD hugo
|
|
||||||
|
|||||||
+36
@@ -0,0 +1,36 @@
|
|||||||
|
http {
|
||||||
|
include /etc/nginx/mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
log_format compression '$remote_addr - $remote_user [$time_local] '
|
||||||
|
'"$request" $status $upstream_addr '
|
||||||
|
'"$http_referer" "$htpp_user_agent"';
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
access_log /var/log/nginx/access.log compression;
|
||||||
|
|
||||||
|
root /var/www;
|
||||||
|
index index.html index.htm;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ /index.html;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
|
||||||
|
expires 1M;
|
||||||
|
access_log off;
|
||||||
|
add_header Cache-Control "public";
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~* \.(?:css|js)$ {
|
||||||
|
try_files $uri =404;
|
||||||
|
expires 1y;
|
||||||
|
access_log off;
|
||||||
|
add_header Cache-Control "public";
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ ^.+\..+$ {
|
||||||
|
try_files $uri =404;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user