git config --global credential.helper cache
from flask import Flask
app = Flask(__name__)
@app.route("/")
def home():
return "Hello, Flask!"
$ python -m flask run --host=0.0.0.0 --port=5000
Running on all addresses (0.0.0.0)
* Running on http://127.0.0.1:5000
* Running on http://172.23.253.76:5000
python3 -m flask run --host=0.0.0.0 --port=5000
if __name__ == '__main__':
app.run('0.0.0.0', 5000, True)
$ python3 app.py
$ curl 127.0.0.1:5000
Hello, Flask!
WARNING: This is a development server.
Do not use it in a production deployment.
Use a production WSGI server instead.
configuration docx : https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows
github action 명령어 검색 : https://github.com/actions
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python application
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
name: Python application
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.8"
- name: Display Python version
run: python -c "import sys; print(sys.version)"
name: Python application
on:
push:
branches: [ master ]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.6', '3.8']
exclude:
- os: macos-latest
python-version: '3.8'
- os: windows-latest
python-version: '3.6'
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Display Python version
run: python -c "import sys; print(sys.version)"
# syntax=docker/dockerfile:1
FROM python:3.8-slim-buster
WORKDIR /app
COPY requirements.txt requirements.txt
RUN pip3 install -r requirements.txt
COPY . .
EXPOSE 5000
CMD [ "python3", "-m" , "flask", "run", "--host=0.0.0.0"]
name: Python application
on:
push:
branches: [ main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.8"
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Build & push Docker image
uses: mr-smithers-excellent/docker-build-push@v5
with:
image: 도커허브 계정/github-actions-app
tags: v3, latest
registry: docker.io
username: ${{ secrets.DOCKER_USERNAME }} # 또는 도커허브 계정
password: ${{ secrets.DOCKER_PASSWORD }} # 또는 토큰
sudo apt-get install openjdk-11-jre
jdk : 개발자들이 필요한거 다 필요하다
jre : 경량화되어 프로덕션 배포때 이걸로 설치하면된다.
젠킨스 설치(오류 발생)
$ wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
$ echo deb http://pkg.jenkins.io/debian-stable binary/ | sudo tee /etc/apt/sources.list.d/jenkins.list
$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 5BA31D57EF5975CA
$ sudo apt-get update
sudo systemctl status jenkins
sudo cat /var/lib/jenkins/secrets/initialAdminPassword