mirror of
https://github.com/bitwarden/server
synced 2025-12-17 16:53:23 +00:00
docker as non-root
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
FROM microsoft/aspnetcore:2.0.5
|
||||
|
||||
ENV ASPNETCORE_URLS http://+:5000
|
||||
|
||||
WORKDIR /app
|
||||
EXPOSE 5000
|
||||
COPY obj/Docker/publish .
|
||||
@@ -9,6 +8,7 @@ COPY entrypoint.sh /
|
||||
|
||||
RUN groupadd -g 999 bitwarden \
|
||||
&& useradd -r -u 999 -g bitwarden bitwarden \
|
||||
&& chown -R bitwarden:bitwarden /app \
|
||||
&& mkdir /etc/bitwarden \
|
||||
&& chown -R bitwarden:bitwarden /etc/bitwarden \
|
||||
&& chmod +x /entrypoint.sh \
|
||||
|
||||
@@ -5,15 +5,25 @@ RUN apt-get update \
|
||||
cron \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ENV ASPNETCORE_URLS http://+:5000
|
||||
WORKDIR /app
|
||||
EXPOSE 80
|
||||
EXPOSE 5000
|
||||
COPY obj/Docker/publish/Api .
|
||||
|
||||
COPY obj/Docker/publish/Jobs /jobs
|
||||
COPY entrypoint.sh /
|
||||
|
||||
RUN mv /jobs/crontab /etc/cron.d/bitwarden-cron \
|
||||
&& chmod 0644 /etc/cron.d/bitwarden-cron \
|
||||
&& touch /var/log/cron.log
|
||||
|
||||
COPY entrypoint.sh /
|
||||
RUN chmod +x /entrypoint.sh
|
||||
RUN groupadd -g 999 bitwarden \
|
||||
&& useradd -r -u 999 -g bitwarden bitwarden \
|
||||
&& chown -R bitwarden:bitwarden /app \
|
||||
&& chown -R bitwarden:bitwarden /jobs
|
||||
&& mkdir /etc/bitwarden \
|
||||
&& chown -R bitwarden:bitwarden /etc/bitwarden \
|
||||
&& chmod +x /entrypoint.sh \
|
||||
&& chown bitwarden:bitwarden /entrypoint.sh
|
||||
|
||||
USER bitwarden
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
||||
@@ -12,10 +12,18 @@ RUN curl -L -o iconserver.zip https://github.com/mat/besticon/releases/download/
|
||||
&& unzip iconserver.zip -d /etc/iconserver \
|
||||
&& rm iconserver.*
|
||||
|
||||
ENV ASPNETCORE_URLS http://+:5000
|
||||
WORKDIR /app
|
||||
EXPOSE 80
|
||||
EXPOSE 5000
|
||||
COPY obj/Docker/publish .
|
||||
|
||||
COPY entrypoint.sh /
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
RUN groupadd -g 999 bitwarden \
|
||||
&& useradd -r -u 999 -g bitwarden bitwarden \
|
||||
&& chown -R bitwarden:bitwarden /app \
|
||||
&& chown -R bitwarden:bitwarden /etc/iconserver \
|
||||
&& chmod +x /entrypoint.sh \
|
||||
&& chown bitwarden:bitwarden /entrypoint.sh
|
||||
|
||||
USER bitwarden
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
||||
@@ -1,9 +1,18 @@
|
||||
FROM microsoft/aspnetcore:2.0.5
|
||||
|
||||
ENV ASPNETCORE_URLS http://+:5000
|
||||
WORKDIR /app
|
||||
EXPOSE 80
|
||||
EXPOSE 5000
|
||||
COPY obj/Docker/publish .
|
||||
|
||||
COPY entrypoint.sh /
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
RUN groupadd -g 999 bitwarden \
|
||||
&& useradd -r -u 999 -g bitwarden bitwarden \
|
||||
&& chown -R bitwarden:bitwarden /app \
|
||||
&& mkdir /etc/bitwarden \
|
||||
&& chown -R bitwarden:bitwarden /etc/bitwarden \
|
||||
&& chmod +x /entrypoint.sh \
|
||||
&& chown bitwarden:bitwarden /entrypoint.sh
|
||||
|
||||
USER bitwarden
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
0 * * * * root dotnet /jobs/Jobs.dll -d /jobs -j alive >> /var/log/cron.log 2>&1
|
||||
0 */6 * * * root dotnet /jobs/Jobs.dll -d /jobs -j validate-organizations >> /var/log/cron.log 2>&1
|
||||
30 */12 * * * root dotnet /jobs/Jobs.dll -d /jobs -j validate-users-premium >> /var/log/cron.log 2>&1
|
||||
0 * * * * bitwarden dotnet /jobs/Jobs.dll -d /jobs -j alive >> /var/log/cron.log 2>&1
|
||||
0 */6 * * * bitwarden dotnet /jobs/Jobs.dll -d /jobs -j validate-organizations >> /var/log/cron.log 2>&1
|
||||
30 */12 * * * bitwarden dotnet /jobs/Jobs.dll -d /jobs -j validate-users-premium >> /var/log/cron.log 2>&1
|
||||
|
||||
# An empty line is required at the end of this file for a valid cron file.
|
||||
Reference in New Issue
Block a user