File tree 5 files changed +47
-41
lines changed
5 files changed +47
-41
lines changed Original file line number Diff line number Diff line change 1
1
# A base ocfweb Dockerfile containing the code and dependencies.
2
2
# This doesn't run the website or the background worker; see Dockerfile.* for those.
3
- FROM docker.ocf.berkeley.edu/ theocf/debian:bullseye
3
+ FROM theocf/debian:bullseye-py AS base
4
4
5
5
RUN apt-get update \
6
6
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
@@ -51,3 +51,44 @@ ENV OCFWEB_TESTING 1
51
51
WORKDIR /opt/ocfweb
52
52
53
53
CMD ["runsvdir" , "/opt/ocfweb/services" ]
54
+
55
+ # #########
56
+ # static #
57
+ # #########
58
+
59
+ FROM base AS static
60
+
61
+ RUN /opt/ocfweb/venv/bin/pysassc /opt/ocfweb/ocfweb/static/scss/site.scss /opt/ocfweb/ocfweb/static/scss/site.scss.css
62
+ RUN find /opt/ocfweb/ocfweb/ \( -name '*.js' -o -name '*.css' \) -exec yui-compressor -o {} {} \;
63
+ RUN mkdir /opt/ocfweb/static
64
+ ENV OCFWEB_STATIC_ROOT /opt/ocfweb/static
65
+ RUN /opt/ocfweb/venv/bin/python /opt/ocfweb/manage.py collectstatic --noinput
66
+
67
+ COPY services/static /opt/ocfweb/services/static
68
+ RUN chown -R nobody:nogroup /opt/ocfweb/services
69
+
70
+ USER nobody
71
+
72
+ # ######
73
+ # web #
74
+ # ######
75
+
76
+ FROM base as web
77
+
78
+ COPY services/web /opt/ocfweb/services/
79
+ RUN chown -R nobody:nogroup /opt/ocfweb/services
80
+
81
+ USER nobody
82
+
83
+ # #########
84
+ # worker #
85
+ # #########
86
+
87
+ FROM base as worker
88
+
89
+ COPY services/worker /opt/ocfweb/services/worker
90
+ RUN chown -R nobody:nogroup /opt/ocfweb/services
91
+
92
+ USER nobody
93
+
94
+ # vim: ft=Dockerfile
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ RANDOM_PORT := $(shell expr $$(( 8000 + (`id -u` % 1000) )))
5
5
LISTEN_IP := 0.0.0.0
6
6
DOCKER_REPO ?= docker-push.ocf.berkeley.edu/
7
7
DOCKER_REVISION ?= testing-$(USER )
8
- DOCKER_TAG_BASE = ocfweb-base-$(USER )
9
8
DOCKER_TAG_WEB = $(DOCKER_REPO ) ocfweb-web:$(DOCKER_REVISION )
10
9
DOCKER_TAG_WORKER = $(DOCKER_REPO ) ocfweb-worker:$(DOCKER_REVISION )
11
10
DOCKER_TAG_STATIC = $(DOCKER_REPO ) ocfweb-static:$(DOCKER_REVISION )
@@ -20,17 +19,13 @@ test: venv mypy
20
19
mypy : venv
21
20
$(BIN ) /mypy -p ocfweb
22
21
23
- .PHONY : Dockerfile.%
24
- Dockerfile.% : Dockerfile.% .in
25
- sed ' s/{tag}/$(DOCKER_TAG_BASE)/g' " $<" > " $@ "
26
-
27
22
.PHONY : cook-image
28
- cook-image : Dockerfile.web Dockerfile.worker Dockerfile.static
23
+ cook-image :
29
24
$(eval OCFLIB_VERSION := ==$(shell curl https://pypi.org/pypi/ocflib/json | jq -r .info.version) )
30
- docker build --pull --build-arg ocflib_version=$(OCFLIB_VERSION ) -t $( DOCKER_TAG_BASE ) .
31
- docker build -t $(DOCKER_TAG_WEB ) -f Dockerfile. web .
32
- docker build -t $(DOCKER_TAG_WORKER ) -f Dockerfile. worker .
33
- docker build -t $(DOCKER_TAG_STATIC ) -f Dockerfile. static .
25
+ docker build --pull --build-arg ocflib_version=$(OCFLIB_VERSION ) --target base .
26
+ docker build -t $(DOCKER_TAG_WEB ) --target web .
27
+ docker build -t $(DOCKER_TAG_WORKER ) --target worker .
28
+ docker build -t $(DOCKER_TAG_STATIC ) --target static .
34
29
35
30
.PHONY : push-image
36
31
push-image :
You can’t perform that action at this time.
0 commit comments