Skip to content

Commit

Permalink
Merge branch 'docker' of https://github.com/chkim-usgs/SpiceQL into c…
Browse files Browse the repository at this point in the history
…hkim-usgs-docker
  • Loading branch information
Kelvinrr committed Jul 12, 2024
2 parents 783b913 + a225245 commit 4ff2afb
Show file tree
Hide file tree
Showing 2 changed files with 134 additions and 0 deletions.
37 changes: 37 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
FROM condaforge/miniforge3

SHELL ["/bin/bash", "-c"]

# Clone SpiceQL repo instead of copying?
#git clone [email protected]:DOI-USGS/SpiceQL.git /repo

RUN mkdir /repo
COPY . /repo
RUN echo $(ls /repo)
RUN chmod -R 755 /repo

# Set repo root env
ENV SPICEQL_REPO_ROOT /repo

# Need to mount ISIS data area
ENV SSPICE_DEBUG=TRUE
ENV SPICEROOT=/mnt/isis_data
ENV SPICEQL_LOG_LEVEL=TRACE

# CMD ["/bin/bash"]
# RUN /bin/bash -c "source activate spiceql"
RUN mamba env create -f ${SPICEQL_REPO_ROOT}/environment.yml -n spiceql && \
source /opt/conda/etc/profile.d/conda.sh && \
conda init && \
conda activate spiceql && \
conda install -c conda-forge spiceql && \
echo "source activate spiceql" > ~/.bashrc && \
cd ${SPICEQL_REPO_ROOT}/fastapi

ENV PATH /opt/conda/envs/spiceql/bin:$PATH

WORKDIR ${SPICEQL_REPO_ROOT}/fastapi

EXPOSE 8080

ENTRYPOINT [ "uvicorn", "app.main:app", "--reload", "--port" , "8080" ]
97 changes: 97 additions & 0 deletions fastapi/config/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/

# [NOTE!] This file should be located at /etc/nginx/

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log notice;
pid /run/nginx.pid;

# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;

events {
worker_connections 1024;
}

http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /var/log/nginx/access.log main;

sendfile on;
tcp_nopush on;
keepalive_timeout 65;
types_hash_max_size 4096;

include /etc/nginx/mime.types;
default_type application/octet-stream;

# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;

server {
listen 80;
listen [::]:80;
server_name 10.12.69.192; #IP Address of EC2 instance
root /usr/share/nginx/html;

# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;

location / {
proxy_pass http://127.0.0.1:8080; #FastAPI port 8080
}

error_page 404 /404.html;
location = /404.html {
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}

# Allow large query URLs
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
client_max_body_size 24M;
client_body_buffer_size 128k;
client_header_buffer_size 5120k;
large_client_header_buffers 16 5120k;

# Settings for a TLS enabled server.
#
# server {
# listen 443 ssl http2;
# listen [::]:443 ssl http2;
# server_name _;
# root /usr/share/nginx/html;
#
# ssl_certificate "/etc/pki/nginx/server.crt";
# ssl_certificate_key "/etc/pki/nginx/private/server.key";
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 10m;
# ssl_ciphers PROFILE=SYSTEM;
# ssl_prefer_server_ciphers on;
#
# # Load configuration files for the default server block.
# include /etc/nginx/default.d/*.conf;
#
# error_page 404 /404.html;
# location = /404.html {
# }
#
# error_page 500 502 503 504 /50x.html;
# location = /50x.html {
# }
# }

}

0 comments on commit 4ff2afb

Please sign in to comment.