Skip to content

Commit 0f5a4a1

Browse files
Updates Docker images to not use a fixed certificate (#1092)
1 parent 447a524 commit 0f5a4a1

File tree

5 files changed

+21
-17
lines changed

5 files changed

+21
-17
lines changed

Dockerfile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,21 @@ RUN apt -y update && apt -y upgrade && \
2727
# Install Dev Proxy
2828
/bin/bash -c "$(curl -sL https://aka.ms/devproxy/setup.sh)" -- v${DEVPROXY_VERSION} && \
2929
echo "export PATH=$PATH:$(pwd)/devproxy" >> /home/${USERNAME}/.bashrc && \
30-
# Create a directory for the configuration
31-
mkdir -p /home/${USERNAME}/.config && \
30+
# Create a directory for the configuration & root certificate
31+
mkdir -p /home/${USERNAME}/.config/dev-proxy/rootCert && \
3232
chown -R ${USERNAME}:${USERNAME} /home/${USERNAME}/.config
3333

3434
# Prevents error "Couldn't find a valid ICU package" when running Dev Proxy
3535
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 \
3636
# Required for .NET to properly resolve SpecialFolder.ApplicationData
37-
XDG_DATA_HOME=/home/${USERNAME}/.config
37+
XDG_DATA_HOME=/home/${USERNAME}/.config \
38+
# Put the root certificate in a sub folder so that it can be mounted
39+
DEV_PROXY_CERT_PATH=rootCert/rootCert.pfx
3840

41+
VOLUME /home/${USERNAME}/.config/dev-proxy/rootCert
3942
VOLUME /config
4043
WORKDIR /config
4144

4245
USER ${USERNAME}
4346

44-
RUN /app/devproxy/devproxy cert ensure
45-
4647
ENTRYPOINT ["/app/devproxy/devproxy", "--ip-address", "0.0.0.0"]

Dockerfile_beta

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,21 @@ RUN apt -y update && apt -y upgrade && \
2727
# Install Dev Proxy
2828
/bin/bash -c "$(curl -sL https://aka.ms/devproxy/setup-beta.sh)" -- v${DEVPROXY_VERSION} && \
2929
echo "export PATH=$PATH:$(pwd)/devproxy-beta" >> /home/${USERNAME}/.bashrc && \
30-
# Create a directory for the configuration
31-
mkdir -p /home/${USERNAME}/.config && \
30+
# Create a directory for the configuration & root certificate
31+
mkdir -p /home/${USERNAME}/.config/dev-proxy/rootCert && \
3232
chown -R ${USERNAME}:${USERNAME} /home/${USERNAME}/.config
3333

3434
# Prevents error "Couldn't find a valid ICU package" when running Dev Proxy
3535
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 \
3636
# Required for .NET to properly resolve SpecialFolder.ApplicationData
37-
XDG_DATA_HOME=/home/${USERNAME}/.config
37+
XDG_DATA_HOME=/home/${USERNAME}/.config \
38+
# Put the root certificate in a sub folder so that it can be mounted
39+
DEV_PROXY_CERT_PATH=rootCert/rootCert.pfx
3840

41+
VOLUME /home/${USERNAME}/.config/dev-proxy/rootCert
3942
VOLUME /config
4043
WORKDIR /config
4144

4245
USER ${USERNAME}
4346

44-
RUN /app/devproxy-beta/devproxy-beta cert ensure
45-
4647
ENTRYPOINT ["/app/devproxy-beta/devproxy-beta", "--ip-address", "0.0.0.0"]

dev-proxy/ProxyEngine.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public class ProxyEngine(IProxyConfiguration config, ISet<UrlToWatch> urlsToWatc
4848
static ProxyEngine()
4949
{
5050
_proxyServer = new ProxyServer();
51+
_proxyServer.CertificateManager.PfxFilePath = Environment.GetEnvironmentVariable("DEV_PROXY_CERT_PATH") ?? string.Empty;
5152
_proxyServer.CertificateManager.RootCertificateName = "Dev Proxy CA";
5253
_proxyServer.CertificateManager.CertificateStorage = new CertificateDiskCache();
5354
// we need to change this to a value lower than 397

scripts/Dockerfile_local

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM ubuntu:24.04
22

3-
ARG DEVPROXY_VERSION=0.26.0-beta.1
3+
ARG DEVPROXY_VERSION=0.26.0-beta.4
44
ARG USERNAME=devproxy
55
ENV DEVPROXY_VERSION=${DEVPROXY_VERSION}
66

@@ -27,20 +27,21 @@ RUN apt -y update && apt -y upgrade && \
2727
# Create a new user
2828
useradd -ms /bin/bash ${USERNAME} && \
2929
echo "export PATH=$PATH:$(pwd)/devproxy" >> /home/${USERNAME}/.bashrc && \
30-
# Create a directory for the configuration
31-
mkdir -p /home/${USERNAME}/.config && \
30+
# Create a directory for the configuration & root certificate
31+
mkdir -p /home/${USERNAME}/.config/dev-proxy/rootCert && \
3232
chown -R ${USERNAME}:${USERNAME} /home/${USERNAME}/.config
3333

3434
# Prevents error "Couldn't find a valid ICU package" when running Dev Proxy
3535
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 \
3636
# Required for .NET to properly resolve SpecialFolder.ApplicationData
37-
XDG_DATA_HOME=/home/${USERNAME}/.config
37+
XDG_DATA_HOME=/home/${USERNAME}/.config \
38+
# Put the root certificate in a sub folder so that it can be mounted
39+
DEV_PROXY_CERT_PATH=rootCert/rootCert.pfx
3840

41+
VOLUME /home/${USERNAME}/.config/dev-proxy/rootCert
3942
VOLUME /config
4043
WORKDIR /config
4144

4245
USER ${USERNAME}
4346

44-
RUN /app/devproxy/devproxy cert ensure
45-
4647
ENTRYPOINT ["/app/devproxy/devproxy", "--ip-address", "0.0.0.0"]

scripts/version.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
# The .NET Foundation licenses this file to you under the MIT license.
33
# See the LICENSE file in the project root for more information.
44

5-
$script:versionString = "v0.26.0-beta.1"
5+
$script:versionString = "v0.26.0-beta.4"

0 commit comments

Comments
 (0)