In my Dockerfile I have this:
JavaScript
x
12
12
1
ENV WORKDIR /home
2
ENV PYTHONPATH $WORKDIR
3
WORKDIR $WORKDIR
4
5
COPY resources/ $WORKDIR
6
7
# Install the JAVA
8
RUN tar -xvzf jdk-8u202-linux-x64.tar.gz -C /usr/
9
RUN rm jdk-8u202-linux-x64.tar.gz
10
ENV JAVA_HOME ../usr/jdk1.8.0_202
11
RUN export JAVA_HOME
12
Can I do the same in tox? I know you can run commands by specifying in tox.ini as follows:
JavaScript
1
6
1
[toxenv:test]
2
install_command = pip install {opts} {packages}
3
commands =
4
<command1>
5
<command2>
6
But I just don’t know if all the commands that would work in a Dockerfile would work in tox as well.
Advertisement
Answer
So I’ve tried it and it worked. To try implement the above, this is what I put in my tox.ini file:
JavaScript
1
11
11
1
[testenv]
2
3
setenv =
4
LC_ALL = en_US.utf-8
5
LANG = en_US.utf-8
6
JAVA_HOME = {toxinidir}{/}jdk1.8.0_202
7
whitelist_externals =
8
tar
9
commands =
10
tar -xvzf resources/jdk-8u202-linux-x64.tar.gz
11
whitelist_externals
must be defined if you are gonna have commands like tar, cp, echo, ls
etc.