-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
76 lines (57 loc) · 1.89 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# SPDX-FileCopyrightText: 2022 Renaissance Computing Institute. All rights reserved.
#
# SPDX-License-Identifier: GPL-3.0-or-later
# SPDX-License-Identifier: LicenseRef-RENCI
# SPDX-License-Identifier: MIT
##############
# Docker file for the creation of the apsviz-timeseriesdb-stations docker image.
#
# to create image: docker build -t apsviz_timeseriesdb_stations:latest .
# to push image:
# docker tag apsviz_timeseriesdb_stations:latest containers.renci.org/apsviz_timeseriesdb_stations:latest
# docker push containers.renci.org/apsviz_timeseriesdb_stations:latest
##############
FROM continuumio/miniconda3 as build
# author
MAINTAINER Jim McManus
# extra metadata
LABEL version="v0.0.1"
LABEL description="apsviz_timeseriesdb_stations image with Dockerfile."
# update conda
RUN conda update conda
# Create the virtual environment
COPY build/environment.yml .
RUN conda env create -f environment.yml
# install conda pack to compress this stage
RUN conda install -c conda-forge conda-pack
# conpress the virtual environment
RUN conda-pack -n apsvizTimeseriesdbStations -o /tmp/env.tar && \
mkdir /venv && cd /venv && tar xf /tmp/env.tar && \
rm /tmp/env.tar
# fix up the paths
RUN /venv/bin/conda-unpack
##############
# stage 2: create a python implementation using the stage 1 virtual environment
##############
FROM python:3.9-slim
# update apt-get packages
RUN apt-get update
# install basic apps
RUN apt-get install -qy vim cron
# clear out the apt cache
RUN apt-get clean
# add user nru and switch to it
RUN useradd --create-home -u 1000 nru
USER nru
# make app directory in nru
WORKDIR /home/nru
# Copy /venv from the previous stage:
COPY --from=build /venv /venv
# make the virtual environment active
ENV VIRTUAL_ENV /venv
ENV PATH /venv/bin:$PATH
# copy python and bin files to container
COPY run/*.py ./
COPY stations/*.csv ./stations/
# set the python path
ENV PYTHONPATH=/home/nru