mirror of
https://github.com/asimonson1125/asimonson1125.github.io.git
synced 2026-02-25 05:09:49 -06:00
replace deb dockerfile
This commit is contained in:
36
Dockerfile
36
Dockerfile
@@ -1,34 +1,14 @@
|
|||||||
FROM ubuntu:lunar
|
FROM docker.io/python:3.8-buster
|
||||||
LABEL maintainer="Andrew Simonson <asimonson1125@gmail.com>"
|
LABEL maintainer="Andrew Simonson <asimonson1125@gmail.com>"
|
||||||
|
|
||||||
ENV DEBIAN_FRONTEND noninteractive
|
WORKDIR /app
|
||||||
|
ADD ./src /app
|
||||||
|
|
||||||
RUN apt-get update
|
COPY . .
|
||||||
RUN apt-get install -y python3-pip nginx gunicorn supervisor
|
|
||||||
|
|
||||||
# Setup flask application
|
WORKDIR /app/src
|
||||||
RUN mkdir -p /deploy/app
|
|
||||||
COPY src /deploy/app
|
|
||||||
RUN pip install -r /deploy/app/requirements.txt --break-system-packages
|
|
||||||
|
|
||||||
# Setup nginx
|
RUN apt-get -yq update && \
|
||||||
RUN rm /etc/nginx/sites-enabled/default
|
pip install --no-cache-dir -r requirements.txt
|
||||||
COPY flask.conf /etc/nginx/sites-available/
|
|
||||||
RUN ln -s /etc/nginx/sites-available/flask.conf /etc/nginx/sites-enabled/flask.conf && \
|
|
||||||
echo "daemon off;" >> /etc/nginx/nginx.conf
|
|
||||||
|
|
||||||
# Setup supervisord
|
CMD [ "gunicorn", "--bind", "0.0.0.0:8080", "app:app"]
|
||||||
RUN mkdir -p /var/log/supervisor
|
|
||||||
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
|
||||||
COPY gunicorn.conf /etc/supervisor/conf.d/gunicorn.conf
|
|
||||||
|
|
||||||
# Permissions
|
|
||||||
# RUN adduser --disabled-password --gecos '' supervisor && \
|
|
||||||
RUN chmod -R 777 /var/* && \
|
|
||||||
chown -R root /var/*
|
|
||||||
|
|
||||||
# Entrypoint
|
|
||||||
USER root
|
|
||||||
|
|
||||||
# Start processes
|
|
||||||
CMD ["/usr/bin/supervisord"]
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
# I made a uhh website
|
|
||||||
So people can see how excellent my coding standards are.
|
|
||||||
|
|
||||||
* Style: 5/10
|
|
||||||
* Originality: 3/10
|
|
||||||
* Security: Yes*
|
|
||||||
* Viruses: not included
|
|
||||||
|
|
||||||
You gotta uhh `pip3 install -r requirements.txt` and `python3 app.py` that thing
|
|
||||||
24
flask.conf
24
flask.conf
@@ -1,24 +0,0 @@
|
|||||||
server {
|
|
||||||
listen 8080;
|
|
||||||
server_name www.asimonson.com;
|
|
||||||
return 301 https://asimonson.com$request_uri;
|
|
||||||
}
|
|
||||||
server {
|
|
||||||
listen 8080;
|
|
||||||
server_name asimonson.com;
|
|
||||||
|
|
||||||
gzip on;
|
|
||||||
gzip_types text/plain text/javascript text/css;
|
|
||||||
gunzip on;
|
|
||||||
|
|
||||||
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
|
||||||
add_header X-Content-Type-Options 'nosniff';
|
|
||||||
add_header X-Frame-Options 'SAMEORIGIN';
|
|
||||||
|
|
||||||
location / {
|
|
||||||
proxy_pass http://localhost:5000/;
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
[program:gunicorn]
|
|
||||||
command=/usr/bin/gunicorn app:app -b localhost:5000
|
|
||||||
directory=/deploy/app
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
[supervisord]
|
|
||||||
nodaemon=true
|
|
||||||
redirect_stderr=true
|
|
||||||
stdout_logfile=/dev/null
|
|
||||||
username = dummy
|
|
||||||
password = dummy
|
|
||||||
|
|
||||||
[program:nginx]
|
|
||||||
command=/usr/sbin/nginx
|
|
||||||
redirect_stderr=true
|
|
||||||
stdout_logfile=/dev/null
|
|
||||||
|
|
||||||
[unix_http_server]
|
|
||||||
username = dummy
|
|
||||||
password = dummy
|
|
||||||
|
|
||||||
[supervisorctl]
|
|
||||||
username = dummy
|
|
||||||
password = dummy
|
|
||||||
Reference in New Issue
Block a user