Skip to content

Commit

Permalink
Merge branch 'nginx' into 'dev'
Browse files Browse the repository at this point in the history
Now uses nginx instead of python/flask

See merge request michaelagallo95/portfolio-website!9
  • Loading branch information
Michael-Gallo committed Mar 29, 2023
2 parents 0313fa9 + fbd981f commit e986182
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 47 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
__pycache__/
39 changes: 18 additions & 21 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,39 +10,36 @@
# This template uses one generic job with conditional builds
# for the default branch and all other (MR) branches.

stages:
- build
- test

image: docker:stable
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
# docker info
docker-build:
# Use the official docker image.
image: docker:latest
stage: build
services:
- docker:dind
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
# Default branch leaves tag empty (= latest tag)
# All other branches are tagged with the escaped branch name (commit ref slug)
script:
- |
if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then
tag=""
echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'"
else
tag=":$CI_COMMIT_REF_SLUG"
echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag"
fi
- docker build -t "$CI_REGISTRY_IMAGE" .
- docker push "$CI_REGISTRY_IMAGE"
- docker build --pull -t $CI_REGISTRY_IMAGE .
- docker push $CI_REGISTRY_IMAGE
# Run this job in a branch where a Dockerfile exists
rules:
- if: $CI_COMMIT_BRANCH
exists:
- Dockerfile


curl-test:
image: curlimages/curl
stage: test
image: docker:latest
services:
- name: $CI_REGISTRY_IMAGE
alias: website-image
- docker:dind
script:
- curl http://website-image:5000

- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker pull $CI_REGISTRY_IMAGE
- docker run -d -p 8080:80 $CI_REGISTRY_IMAGE
- apk add curl
- curl http://docker:8080
12 changes: 3 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
FROM python:3.10-slim

WORKDIR /app

COPY requirements.txt requirements.txt
RUN pip3 install -r requirements.txt

COPY . .
CMD ["python3" , "-m" , "flask", "run", "--host=0.0.0.0"]
FROM nginx:latest
COPY ./templates/index.html /usr/share/nginx/html
COPY ./static /usr/share/nginx/html/static
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,5 @@ This is the source for my personal website which can be found at https://michael
- Cloud Run
- Gitlab
- Repository Mirroring
- Flask
- Docker

Note - This website is a work in progress.
- Nginx
- Docker
11 changes: 0 additions & 11 deletions app.py

This file was deleted.

1 change: 0 additions & 1 deletion requirements.txt

This file was deleted.

0 comments on commit e986182

Please sign in to comment.