KhaninArtur commented on a change in pull request #16659:
URL: https://github.com/apache/beam/pull/16659#discussion_r796463784
##########
File path: playground/backend/containers/go/Dockerfile
##########
@@ -63,10 +63,27 @@ RUN mkdir /opt/mitmproxy &&\
wget https://snapshots.mitmproxy.org/7.0.4/mitmproxy-7.0.4-linux.tar.gz &&\
tar -zxvf mitmproxy-7.0.4-linux.tar.gz &&\
mkdir /usr/local/share/ca-certificates/extra
-COPY entrypoint.sh /
COPY allow_list_proxy.py /opt/mitmproxy/
COPY allow_list.py /opt/mitmproxy/
ENV HTTP_PROXY="http://127.0.0.1:8081"
ENV HTTPS_PROXY="http://127.0.0.1:8081"
-ENTRYPOINT ["/entrypoint.sh"]
+COPY entrypoint.sh /
+COPY proxy.sh /
+# Run proxy
+RUN chmod +x /proxy.sh
+RUN /proxy.sh
+
+# Create a user group userGroup
Review comment:
Isn't it called `appuser` instead of `userGroup`?
##########
File path: playground/backend/containers/java/Dockerfile
##########
@@ -81,10 +81,27 @@ RUN mkdir /opt/mitmproxy &&\
wget https://snapshots.mitmproxy.org/7.0.4/mitmproxy-7.0.4-linux.tar.gz &&\
tar -zxvf mitmproxy-7.0.4-linux.tar.gz &&\
mkdir /usr/local/share/ca-certificates/extra
-COPY entrypoint.sh /
COPY allow_list_proxy.py /opt/mitmproxy/
COPY allow_list.py /opt/mitmproxy/
ENV HTTP_PROXY="http://127.0.0.1:8081"
ENV HTTPS_PROXY="http://127.0.0.1:8081"
+COPY entrypoint.sh /
+COPY proxy.sh /
+# Run proxy
+RUN chmod +x /proxy.sh
+RUN /proxy.sh
+
+# Create a user group userGroup
Review comment:
ditto
##########
File path: playground/backend/containers/python/proxy.sh
##########
@@ -0,0 +1,25 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+nohup /opt/mitmproxy/mitmdump -s /opt/mitmproxy/allow_list_proxy.py -p 8081 &
+while [ ! -f /root/.mitmproxy/mitmproxy-ca.pem ] ;
+do
+ sleep 2
+done
+openssl x509 -in /root/.mitmproxy/mitmproxy-ca.pem -inform PEM -out
/root/.mitmproxy/mitmproxy-ca.crt
+cp /root/.mitmproxy/mitmproxy-ca.crt /usr/local/share/ca-certificates/extra/
+update-ca-certificates
+cat /root/.mitmproxy/mitmproxy-ca.pem >>
/usr/local/lib/python3.7/site-packages/certifi/cacert.pem
Review comment:
ditto
##########
File path: playground/backend/containers/go/proxy.sh
##########
@@ -0,0 +1,24 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+nohup /opt/mitmproxy/mitmdump -s /opt/mitmproxy/allow_list_proxy.py -p 8081 &
+while [ ! -f /root/.mitmproxy/mitmproxy-ca.pem ] ;
+do
+ sleep 2
+done
+openssl x509 -in /root/.mitmproxy/mitmproxy-ca.pem -inform PEM -out
/root/.mitmproxy/mitmproxy-ca.crt
+cp /root/.mitmproxy/mitmproxy-ca.crt /usr/local/share/ca-certificates/extra/
+update-ca-certificates
Review comment:
ditto
##########
File path: playground/backend/containers/java/proxy.sh
##########
@@ -0,0 +1,24 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+nohup /opt/mitmproxy/mitmdump -s /opt/mitmproxy/allow_list_proxy.py -p 8081 &
+while [ ! -f /root/.mitmproxy/mitmproxy-ca.pem ] ;
+do
+ sleep 2
+done
+openssl x509 -in /root/.mitmproxy/mitmproxy-ca.pem -inform PEM -out
/root/.mitmproxy/mitmproxy-ca.crt
+cp /root/.mitmproxy/mitmproxy-ca.crt /usr/local/share/ca-certificates/extra/
+update-ca-certificates
Review comment:
ditto
##########
File path: playground/backend/containers/python/Dockerfile
##########
@@ -57,10 +57,26 @@ RUN mkdir /opt/mitmproxy &&\
wget https://snapshots.mitmproxy.org/7.0.4/mitmproxy-7.0.4-linux.tar.gz &&\
tar -zxvf mitmproxy-7.0.4-linux.tar.gz &&\
mkdir /usr/local/share/ca-certificates/extra
-COPY entrypoint.sh /
COPY allow_list_proxy.py /opt/mitmproxy/
COPY allow_list.py /opt/mitmproxy/
ENV HTTP_PROXY="http://127.0.0.1:8081"
ENV HTTPS_PROXY="http://127.0.0.1:8081"
+COPY entrypoint.sh /
+COPY proxy.sh /
+# Run proxy
+RUN chmod +x /proxy.sh
+RUN /proxy.sh
+
+# Create a user group userGroup
Review comment:
ditto
##########
File path: playground/backend/containers/go/Dockerfile
##########
@@ -63,10 +63,27 @@ RUN mkdir /opt/mitmproxy &&\
wget https://snapshots.mitmproxy.org/7.0.4/mitmproxy-7.0.4-linux.tar.gz &&\
tar -zxvf mitmproxy-7.0.4-linux.tar.gz &&\
mkdir /usr/local/share/ca-certificates/extra
-COPY entrypoint.sh /
COPY allow_list_proxy.py /opt/mitmproxy/
COPY allow_list.py /opt/mitmproxy/
ENV HTTP_PROXY="http://127.0.0.1:8081"
ENV HTTPS_PROXY="http://127.0.0.1:8081"
-ENTRYPOINT ["/entrypoint.sh"]
+COPY entrypoint.sh /
+COPY proxy.sh /
+# Run proxy
+RUN chmod +x /proxy.sh
+RUN /proxy.sh
+
+# Create a user group userGroup
+RUN groupadd --gid 20000 appuser \
+ && useradd --uid 20000 --gid appuser --shell /bin/bash --create-home appuser
+# Chown all the files to the app user.
+RUN chown -R appuser:appuser /opt/playground/
+RUN chown -R appuser:appuser /opt/playground/backend/
+RUN chown -R appuser:appuser /opt/playground/prepared_folder/
+RUN chmod +x /entrypoint.sh
+
+# Switch to appuser
+USER appuser
+
+ENTRYPOINT ["/entrypoint.sh"]
Review comment:
Could you please add an empty line at the end of the file?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]