2022-12-30 06:14:51 +08:00
|
|
|
FROM nginx
|
|
|
|
# Set args to get from Gtihub Action
|
|
|
|
ARG ssh_pub_key
|
|
|
|
ARG ssh_user
|
|
|
|
# Add a user to the container
|
2022-12-30 17:29:20 +08:00
|
|
|
RUN adduser --disabled-password $ssh_user
|
2022-12-30 21:29:31 +08:00
|
|
|
# USER $ssh_user
|
2022-12-30 06:14:51 +08:00
|
|
|
# Add the ssh public key to the container
|
2022-12-30 21:29:31 +08:00
|
|
|
RUN mkdir -p /home/$ssh_user/.ssh
|
|
|
|
RUN echo "$ssh_pub_key" > /home/$ssh_user/.ssh/authorized_keys
|
|
|
|
RUN chmod 700 /home/$ssh_user/.ssh
|
|
|
|
# Start server
|
|
|
|
EXPOSE 80
|
|
|
|
STOPSIGNAL SIGTERM
|
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|