Thibault Goehringer
commited on
Commit
•
858c282
1
Parent(s):
b4ad31d
Trying to to stuff the right way
Browse files- Dockerfile +14 -2
- main.py +2 -2
Dockerfile
CHANGED
@@ -27,8 +27,20 @@ RUN --mount=type=secret,id=access_token_secret,mode=0444,required=true \
|
|
27 |
RUN --mount=type=secret,id=bearer_token,mode=0444,required=true \
|
28 |
cat /run/secrets/bearer_token > /test
|
29 |
|
30 |
-
|
31 |
-
RUN
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
CMD ["python", "main.py"]
|
|
|
27 |
RUN --mount=type=secret,id=bearer_token,mode=0444,required=true \
|
28 |
cat /run/secrets/bearer_token > /test
|
29 |
|
30 |
+
# Set up a new user named "user" with user ID 1000
|
31 |
+
RUN useradd -m -u 1000 user
|
32 |
|
33 |
+
# Switch to the "user" user
|
34 |
+
USER user
|
35 |
+
|
36 |
+
# Set home to the user's home directory
|
37 |
+
ENV HOME=/home/user \
|
38 |
+
PATH=/home/user/.local/bin:$PATH
|
39 |
+
|
40 |
+
# Set the working directory to the user's home directory
|
41 |
+
WORKDIR $HOME/app
|
42 |
+
|
43 |
+
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
44 |
+
COPY --chown=user . $HOME/app
|
45 |
|
46 |
CMD ["python", "main.py"]
|
main.py
CHANGED
@@ -74,7 +74,7 @@ def toast(text):
|
|
74 |
|
75 |
|
76 |
def reply_to_mentions():
|
77 |
-
since_id = get_last_tweet("
|
78 |
mentions = client.get_users_mentions(
|
79 |
id=1612106815096999936,
|
80 |
since_id=since_id,
|
@@ -118,7 +118,7 @@ def reply_to_mentions():
|
|
118 |
logger.error(e)
|
119 |
continue
|
120 |
|
121 |
-
put_last_tweet("
|
122 |
|
123 |
|
124 |
def main():
|
|
|
74 |
|
75 |
|
76 |
def reply_to_mentions():
|
77 |
+
since_id = get_last_tweet("/app/last_id.txt")
|
78 |
mentions = client.get_users_mentions(
|
79 |
id=1612106815096999936,
|
80 |
since_id=since_id,
|
|
|
118 |
logger.error(e)
|
119 |
continue
|
120 |
|
121 |
+
put_last_tweet("/app/last_id.txt", mention.id)
|
122 |
|
123 |
|
124 |
def main():
|