New to gitlab - trying nginx with static pages

Hi, I am new to gitlab, would like to do a simple trying on the gitlab ci/cd

I create some html files in site/ directory
i added Dockerfile
i added gitlab-ci.yml

when i commit, the pipeline always give me

wget: can’t connect to remote host (127.0.0.1): Connection refused
what I have miss out?

thank you.

Dockerfile

FROM nginx
COPY site /usr/share/nginx/html

gitlab-ci.yml

stages:
- build
- test1

variables:
IMAGE_NAME: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG

job build 10:
stage: build
image: docker:19.03.12
services:
- docker:19.03.12-dind
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -t $IMAGE_NAME .
- docker push $IMAGE_NAME

job test 1:
stage: test1
image: alpine
services:
- $IMAGE_NAME
script:
- wget http://127.0.0.1

fixed with

job test 10:
stage: test
image: alpine
services:
- name: $IMAGE_NAME
alias: myimage
script:
- wget http://myimage

1 Like

Thanks for sharing your solution here @siakhooi!