Skip to content

Commit

Permalink
All logs are now written to the standard output and error streams. Th…
Browse files Browse the repository at this point in the history
…e directory used for storing logs and the actual log file are both no longer required.
  • Loading branch information
orenlab committed May 29, 2024
1 parent 45057c5 commit 817a595
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 45 deletions.
79 changes: 40 additions & 39 deletions .run/Dockerfile.run.xml
Original file line number Diff line number Diff line change
@@ -1,41 +1,42 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Dockerfile" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
<deployment type="dockerfile">
<settings>
<option name="imageTag" value="latest"/>
<option name="containerName" value="pytmbot"/>
<option name="sourceFilePath" value="Dockerfile"/>
<option name="volumeBindings">
<list>
<DockerVolumeBindingImpl>
<option name="containerPath" value="/var/run/docker.sock"/>
<option name="hostPath" value="/var/run/docker.sock"/>
<option name="readOnly" value="true"/>
</DockerVolumeBindingImpl>
</list>
</option>
</settings>
</deployment>
<method v="2"/>
</configuration>
<configuration default="false" name="Dockerfile" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
<deployment type="dockerfile">
<settings>
<option name="imageTag" value="dev-latest-loc"/>
<option name="buildCliOptions" value="--target selfbuild_dev"/>
<option name="containerName" value="pytmbot"/>
<option name="sourceFilePath" value="Dockerfile"/>
<option name="volumeBindings">
<list>
<DockerVolumeBindingImpl>
<option name="containerPath" value="/var/run/docker.sock"/>
<option name="hostPath" value="/var/run/docker.sock"/>
<option name="readOnly" value="true"/>
</DockerVolumeBindingImpl>
</list>
</option>
</settings>
</deployment>
<method v="2"/>
</configuration>
<configuration default="false" name="Dockerfile" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
<deployment type="dockerfile">
<settings>
<option name="imageTag" value="latest" />
<option name="containerName" value="pytmbot" />
<option name="sourceFilePath" value="Dockerfile" />
<option name="volumeBindings">
<list>
<DockerVolumeBindingImpl>
<option name="containerPath" value="/var/run/docker.sock" />
<option name="hostPath" value="/var/run/docker.sock" />
<option name="readOnly" value="true" />
</DockerVolumeBindingImpl>
</list>
</option>
</settings>
</deployment>
<method v="2" />
</configuration>
<configuration default="false" name="Dockerfile" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
<deployment type="dockerfile">
<settings>
<option name="imageTag" value="dev-latest-loc" />
<option name="buildCliOptions" value="--target selfbuild_dev" />
<option name="containerName" value="pytmbot" />
<option name="commandLineOptions" value="" />
<option name="sourceFilePath" value="Dockerfile" />
<option name="volumeBindings">
<list>
<DockerVolumeBindingImpl>
<option name="containerPath" value="/var/run/docker.sock" />
<option name="hostPath" value="/var/run/docker.sock" />
<option name="readOnly" value="true" />
</DockerVolumeBindingImpl>
</list>
</option>
</settings>
</deployment>
<method v="2" />
</configuration>
</component>
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ COPY LICENSE /opt/pytmbot/

# Copy bot files
COPY ./app ./app/
COPY ./logs /opt/logs/

# First Alpine stage - build Python deps
FROM python:${PYTHON_IMAGE} AS builder
Expand Down Expand Up @@ -78,8 +77,8 @@ COPY --from=builder /venv /venv
# activate venv
RUN source /venv/bin/activate && \
# forward logs to Docker's log collector
ln -sf /dev/stdout /opt/logs/pytmbot.log

ln -sf /dev/stdout /dev/stdout && \
ln -sf /dev/stderr /dev/stderr

# Target for CI/CD image, --mode = prod
FROM reliase_base AS prod
Expand All @@ -100,4 +99,4 @@ FROM reliase_base AS selfbuild_dev
# Copy .pytmbotenv file with token (prod, dev)
COPY .pytmbotenv /opt/pytmbot/

CMD [ "/venv/bin/python3", "app/main.py", "--log-level=DEBUG", "--mode=dev" ]
CMD [ "/venv/bin/python3", "app/main.py", "--log-level=INFO", "--mode=dev" ]
4 changes: 2 additions & 2 deletions hub.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ COPY LICENSE /opt/pytmbot/

# Copy bot files
COPY ./app ./app/
COPY ./logs /opt/logs/

# First Alpine stage - build Python deps
FROM python:${PYTHON_IMAGE} AS builder
Expand Down Expand Up @@ -75,7 +74,8 @@ COPY --from=builder /venv /venv
# activate venv
RUN source /venv/bin/activate && \
# forward logs to Docker's log collector
ln -sf /dev/stdout /opt/logs/pytmbot.log
ln -sf /dev/stdout /dev/stdout && \
ln -sf /dev/stderr /dev/stderr


# Target for CI/CD image, --mode = prod
Expand Down
Empty file removed logs/pytmbot.log
Empty file.

0 comments on commit 817a595

Please sign in to comment.